coreutils: import from packages, add myself as maintainer
authorJo-Philipp Wich <jow@openwrt.org>
Wed, 11 Jun 2014 15:02:24 +0000 (17:02 +0200)
committerJo-Philipp Wich <jow@openwrt.org>
Wed, 11 Jun 2014 15:02:24 +0000 (17:02 +0200)
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
utils/coreutils/Makefile [new file with mode: 0644]
utils/coreutils/patches/001-no_docs_man_tests.patch [new file with mode: 0644]
utils/coreutils/patches/002-fix_compile_with_uclibc.patch [new file with mode: 0644]
utils/coreutils/patches/010-fix-gets-removal.patch [new file with mode: 0644]

diff --git a/utils/coreutils/Makefile b/utils/coreutils/Makefile
new file mode 100644 (file)
index 0000000..b7c927d
--- /dev/null
@@ -0,0 +1,110 @@
+#
+# Copyright (C) 2008-2014 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=coreutils
+PKG_VERSION:=8.16
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=@GNU/coreutils
+PKG_MD5SUM:=89b06f91634208dceba7b36ad1f9e8b9
+PKG_BUILD_DEPENDS:=libpthread
+PKG_MAINTAINER:=Jo-Philipp Wich <jow@openwrt.org>
+
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+COREUTILS_APPLETS := \
+       base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit \
+       cut date dd dir dircolors dirname du echo env expand expr factor        \
+       false fmt fold groups head hostid id install join kill link ln logname  \
+       ls md5sum mkdir mkfifo mknod mktemp mv nice nl nohup nproc od paste     \
+       pathchk pinky pr printenv printf ptx pwd readlink realpath rm rmdir     \
+       runcon seq sha1sum sha224sum sha256sum sha384sum sha512sum shred        \
+       shuf sleep sort split stat stdbuf stty sum sync tac tail tee test       \
+       timeout touch tr true truncate tsort tty uname unexpand uniq unlink     \
+       uptime users vdir wc who whoami yes
+
+DEPENDS_sort = +libpthread
+DEPENDS_timeout = +librt
+DEPENDS_uptime = +libelf1
+DEPENDS_expr = +libgmp
+DEPENDS_factor = +libgmp
+
+define Package/coreutils/Default
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=The GNU core utilities
+  URL:=http://www.gnu.org/software/coreutils/
+endef
+
+define Package/coreutils
+  $(call Package/coreutils/Default)
+  TITLE:=The GNU core utilities
+  MENU:=1
+endef
+
+define Package/coreutils/description
+ Full versions of standard GNU utilities. Normally, you would not use this
+ package, since the functionality in BusyBox is more than sufficient and
+ smaller.
+endef
+
+define GenPlugin
+ define Package/$(1)
+   $(call Package/coreutils/Default)
+   DEPENDS:=coreutils $(DEPENDS_$(2))
+   TITLE:=Utility $(2) from the GNU core utilities
+ endef
+
+ define Package/$(1)/description
+  Full version of standard GNU $(2) utility. Normally, you would not use this
+  package, since the functionality in BusyBox is more than sufficient.
+ endef
+endef
+
+$(foreach a,$(COREUTILS_APPLETS),$(eval $(call GenPlugin,coreutils-$(a),$(a))))
+
+CONFIGURE_VARS += \
+       gl_cv_func_mbrtowc_incomplete_state=yes \
+       gl_cv_func_mbrtowc_retval=yes \
+       gl_cv_func_wcrtomb_retval=yes
+
+ifneq ($(CONFIG_USE_UCLIBC),)
+  CONFIGURE_VARS += \
+       ac_cv_type_pthread_spinlock_t=$(if $(filter 0.9.30% 0.9.2% 0.9.31%,$(call qstrip,$(CONFIG_UCLIBC_VERSION))),no,yes)
+endif
+
+CONFIGURE_ARGS += \
+       --enable-install-program=su
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               SHELL="/bin/bash" \
+               all install install-root
+endef
+
+define Package/coreutils/install
+       true
+endef
+
+define BuildPlugin
+  define Package/$(1)/install
+       $(INSTALL_DIR) $$(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(2) $$(1)/usr/bin/
+  endef
+
+  $$(eval $$(call BuildPackage,$(1)))
+endef
+
+$(eval $(call BuildPackage,coreutils))
+
+$(foreach a,$(COREUTILS_APPLETS),$(eval $(call BuildPlugin,coreutils-$(a),$(a))))
diff --git a/utils/coreutils/patches/001-no_docs_man_tests.patch b/utils/coreutils/patches/001-no_docs_man_tests.patch
new file mode 100644 (file)
index 0000000..2c04117
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -17,7 +17,7 @@
+ ALL_RECURSIVE_TARGETS =
+-SUBDIRS = lib src doc man po tests gnulib-tests
++SUBDIRS = lib src po
+ changelog_etc =                               \
+   ChangeLog-2005                      \
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -1639,7 +1639,7 @@ top_srcdir = @top_srcdir@
+ # Some tests always need root privileges, others need them only sometimes.
+ ALL_RECURSIVE_TARGETS = install-root check-root distcheck-hook
+-SUBDIRS = lib src doc man po tests gnulib-tests
++SUBDIRS = lib src po
+ changelog_etc = \
+   ChangeLog-2005                      \
+   ChangeLog-2006                      \
diff --git a/utils/coreutils/patches/002-fix_compile_with_uclibc.patch b/utils/coreutils/patches/002-fix_compile_with_uclibc.patch
new file mode 100644 (file)
index 0000000..bee8a56
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/lib/pthread.in.h
++++ b/lib/pthread.in.h
+@@ -232,6 +232,9 @@ pthread_mutex_unlock (pthread_mutex_t *m
+ /* Approximate spinlocks with mutexes.  */
++#ifdef __UCLIBC__
++#define pthread_spinlock_t original_pthread_spinlock_t
++#endif
+ typedef pthread_mutex_t pthread_spinlock_t;
+ static inline int
diff --git a/utils/coreutils/patches/010-fix-gets-removal.patch b/utils/coreutils/patches/010-fix-gets-removal.patch
new file mode 100644 (file)
index 0000000..2be5fc4
--- /dev/null
@@ -0,0 +1,15 @@
+diff --git a/lib/stdio.in.h b/lib/stdio.in.h
+index 9dc7c4a..9fdac77 100644
+--- a/lib/stdio.in.h
++++ b/lib/stdio.in.h
+@@ -711,10 +711,6 @@ _GL_CXXALIAS_SYS (gets, char *, (char *s));
+ #  undef gets
+ # endif
+ _GL_CXXALIASWARN (gets);
+-/* It is very rare that the developer ever has full control of stdin,
+-   so any use of gets warrants an unconditional warning.  Assume it is
+-   always declared, since it is required by C89.  */
+-_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+ #endif