coreutils.mk 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #############################################################
  2. #
  3. # coreutils
  4. #
  5. #############################################################
  6. COREUTILS_SOURCE:=coreutils-5.0.tar.bz2
  7. COREUTILS_SITE:=ftp://ftp.gnu.org/gnu/coreutils/
  8. COREUTILS_CAT:=bzcat
  9. COREUTILS_DIR:=$(BUILD_DIR)/coreutils-5.0
  10. COREUTILS_BINARY:=src/vdir
  11. COREUTILS_TARGET_BINARY:=bin/vdir
  12. BIN_PROGS:=cat chgrp chmod chown cp date dd df dir echo false hostname \
  13. ln ls mkdir mknod mv pwd rm rmdir vdir sleep stty sync touch true uname
  14. $(DL_DIR)/$(COREUTILS_SOURCE):
  15. $(WGET) -P $(DL_DIR) $(COREUTILS_SITE)/$(COREUTILS_SOURCE)
  16. coreutils-source: $(DL_DIR)/$(COREUTILS_SOURCE)
  17. $(COREUTILS_DIR)/.unpacked: $(DL_DIR)/$(COREUTILS_SOURCE)
  18. $(COREUTILS_CAT) $(DL_DIR)/$(COREUTILS_SOURCE) | tar -C $(BUILD_DIR) -xvf -
  19. touch $(COREUTILS_DIR)/.unpacked
  20. $(COREUTILS_DIR)/.configured: $(COREUTILS_DIR)/.unpacked
  21. (cd $(COREUTILS_DIR); rm -rf config.cache; \
  22. $(TARGET_CONFIGURE_OPTS) \
  23. CFLAGS="$(TARGET_CFLAGS)" \
  24. ./configure \
  25. --target=$(GNU_TARGET_NAME) \
  26. --host=$(GNU_TARGET_NAME) \
  27. --build=$(GNU_HOST_NAME) \
  28. --prefix=/usr \
  29. --exec-prefix=/usr \
  30. --bindir=/usr/bin \
  31. --sbindir=/usr/sbin \
  32. --libexecdir=/usr/lib \
  33. --sysconfdir=/etc \
  34. --datadir=/usr/share \
  35. --localstatedir=/var \
  36. --mandir=/usr/man \
  37. --infodir=/usr/info \
  38. $(DISABLE_NLS) \
  39. $(DISABLE_LARGEFILE) \
  40. --disable-rpath \
  41. --disable-dependency-tracking \
  42. );
  43. #Fix up the max number of open files per process, which apparently
  44. # is not set when cross compiling
  45. $(SED) 's,.*UTILS_OPEN_MAX.*,#define UTILS_OPEN_MAX 1019,g' \
  46. $(COREUTILS_DIR)/config.h
  47. # This is undefined when crosscompiling...
  48. $(SED) 's,.*HAVE_PROC_UPTIME.*,#define HAVE_PROC_UPTIME 1,g' \
  49. $(COREUTILS_DIR)/config.h
  50. touch $(COREUTILS_DIR)/.configured
  51. $(COREUTILS_DIR)/$(COREUTILS_BINARY): $(COREUTILS_DIR)/.configured
  52. $(MAKE) CC=$(TARGET_CC) -C $(COREUTILS_DIR)
  53. rm -f $(TARGET_DIR)/$(COREUTILS_TARGET_BINARY)
  54. $(TARGET_DIR)/$(COREUTILS_TARGET_BINARY): $(COREUTILS_DIR)/$(COREUTILS_BINARY)
  55. $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(COREUTILS_DIR) install
  56. # some things go in root rather than usr
  57. for f in $(BIN_PROGS); do \
  58. mv $(TARGET_DIR)/usr/bin/$$f $(TARGET_DIR)/bin/$$f; \
  59. done
  60. # link for archaic shells
  61. ln -fs test $(TARGET_DIR)/usr/bin/[
  62. # gnu thinks chroot is in bin, debian thinks it's in sbin
  63. mv $(TARGET_DIR)/usr/bin/chroot $(TARGET_DIR)/usr/sbin/chroot
  64. $(STRIP) $(TARGET_DIR)/usr/sbin/chroot > /dev/null 2>&1
  65. rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \
  66. $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc
  67. coreutils: uclibc $(TARGET_DIR)/$(COREUTILS_TARGET_BINARY)
  68. coreutils-clean:
  69. $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(COREUTILS_DIR) uninstall
  70. -$(MAKE) -C $(COREUTILS_DIR) clean
  71. coreutils-dirclean:
  72. rm -rf $(COREUTILS_DIR)