coreutils.mk 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #############################################################
  2. #
  3. # coreutils
  4. #
  5. #############################################################
  6. COREUTILS_VER:=5.2.1
  7. COREUTILS_SOURCE:=coreutils-$(COREUTILS_VER).tar.bz2
  8. COREUTILS_SITE:=ftp://ftp.gnu.org/gnu/coreutils/
  9. COREUTILS_CAT:=bzcat
  10. COREUTILS_DIR:=$(BUILD_DIR)/coreutils-$(COREUTILS_VER)
  11. COREUTILS_BINARY:=src/vdir
  12. COREUTILS_TARGET_BINARY:=bin/vdir
  13. BIN_PROGS:=cat chgrp chmod chown cp date dd df dir echo false hostname \
  14. ln ls mkdir mknod mv pwd rm rmdir vdir sleep stty sync touch true uname
  15. $(DL_DIR)/$(COREUTILS_SOURCE):
  16. $(WGET) -P $(DL_DIR) $(COREUTILS_SITE)/$(COREUTILS_SOURCE)
  17. coreutils-source: $(DL_DIR)/$(COREUTILS_SOURCE)
  18. $(COREUTILS_DIR)/.unpacked: $(DL_DIR)/$(COREUTILS_SOURCE)
  19. $(COREUTILS_CAT) $(DL_DIR)/$(COREUTILS_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
  20. toolchain/patch-kernel.sh $(COREUTILS_DIR) package/coreutils/ coreutils*.patch
  21. touch $(COREUTILS_DIR)/.unpacked
  22. $(COREUTILS_DIR)/.configured: $(COREUTILS_DIR)/.unpacked
  23. (cd $(COREUTILS_DIR); rm -rf config.cache; \
  24. $(TARGET_CONFIGURE_OPTS) \
  25. CFLAGS="$(TARGET_CFLAGS)" \
  26. ac_cv_func_strtod=yes \
  27. ./configure \
  28. --target=$(GNU_TARGET_NAME) \
  29. --host=$(GNU_TARGET_NAME) \
  30. --build=$(GNU_HOST_NAME) \
  31. --prefix=/usr \
  32. --exec-prefix=/usr \
  33. --bindir=/usr/bin \
  34. --sbindir=/usr/sbin \
  35. --libexecdir=/usr/lib \
  36. --sysconfdir=/etc \
  37. --datadir=/usr/share \
  38. --localstatedir=/var \
  39. --mandir=/usr/man \
  40. --infodir=/usr/info \
  41. $(DISABLE_NLS) \
  42. $(DISABLE_LARGEFILE) \
  43. --disable-rpath \
  44. --disable-dependency-tracking \
  45. );
  46. #Fix up the max number of open files per process, which apparently
  47. # is not set when cross compiling
  48. $(SED) 's,.*UTILS_OPEN_MAX.*,#define UTILS_OPEN_MAX 1019,g' \
  49. $(COREUTILS_DIR)/config.h
  50. # This is undefined when crosscompiling...
  51. $(SED) 's,.*HAVE_PROC_UPTIME.*,#define HAVE_PROC_UPTIME 1,g' \
  52. $(COREUTILS_DIR)/config.h
  53. touch $(COREUTILS_DIR)/.configured
  54. $(COREUTILS_DIR)/$(COREUTILS_BINARY): $(COREUTILS_DIR)/.configured
  55. $(MAKE) CC=$(TARGET_CC) -C $(COREUTILS_DIR)
  56. rm -f $(TARGET_DIR)/$(COREUTILS_TARGET_BINARY)
  57. $(TARGET_DIR)/$(COREUTILS_TARGET_BINARY): $(COREUTILS_DIR)/$(COREUTILS_BINARY)
  58. $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(COREUTILS_DIR) install
  59. # some things go in root rather than usr
  60. for f in $(BIN_PROGS); do \
  61. mv $(TARGET_DIR)/usr/bin/$$f $(TARGET_DIR)/bin/$$f; \
  62. done
  63. # link for archaic shells
  64. ln -fs test $(TARGET_DIR)/usr/bin/[
  65. # gnu thinks chroot is in bin, debian thinks it's in sbin
  66. mv $(TARGET_DIR)/usr/bin/chroot $(TARGET_DIR)/usr/sbin/chroot
  67. $(STRIP) $(TARGET_DIR)/usr/sbin/chroot > /dev/null 2>&1
  68. rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \
  69. $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc
  70. #If both coreutils and busybox are selected, make certain coreutils
  71. #wins the fight over who gets to have their utils actually installed
  72. ifeq ($(BR2_PACKAGE_BUSYBOX),y)
  73. coreutils: uclibc busybox $(TARGET_DIR)/$(COREUTILS_TARGET_BINARY)
  74. else
  75. coreutils: uclibc $(TARGET_DIR)/$(COREUTILS_TARGET_BINARY)
  76. endif
  77. coreutils-clean:
  78. $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(COREUTILS_DIR) uninstall
  79. -$(MAKE) -C $(COREUTILS_DIR) clean
  80. coreutils-dirclean:
  81. rm -rf $(COREUTILS_DIR)
  82. #############################################################
  83. #
  84. # Toplevel Makefile options
  85. #
  86. #############################################################
  87. ifeq ($(strip $(BR2_PACKAGE_COREUTILS)),y)
  88. TARGETS+=coreutils
  89. endif