coreutils.mk 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. touch $(COREUTILS_DIR)/.unpacked
  21. $(COREUTILS_DIR)/.configured: $(COREUTILS_DIR)/.unpacked
  22. (cd $(COREUTILS_DIR); rm -rf config.cache; \
  23. $(TARGET_CONFIGURE_OPTS) \
  24. CFLAGS="$(TARGET_CFLAGS)" \
  25. ac_cv_func_strtod=yes \
  26. ./configure \
  27. --target=$(GNU_TARGET_NAME) \
  28. --host=$(GNU_TARGET_NAME) \
  29. --build=$(GNU_HOST_NAME) \
  30. --prefix=/usr \
  31. --exec-prefix=/usr \
  32. --bindir=/usr/bin \
  33. --sbindir=/usr/sbin \
  34. --libexecdir=/usr/lib \
  35. --sysconfdir=/etc \
  36. --datadir=/usr/share \
  37. --localstatedir=/var \
  38. --mandir=/usr/man \
  39. --infodir=/usr/info \
  40. $(DISABLE_NLS) \
  41. $(DISABLE_LARGEFILE) \
  42. --disable-rpath \
  43. --disable-dependency-tracking \
  44. );
  45. #Fix up the max number of open files per process, which apparently
  46. # is not set when cross compiling
  47. $(SED) 's,.*UTILS_OPEN_MAX.*,#define UTILS_OPEN_MAX 1019,g' \
  48. $(COREUTILS_DIR)/config.h
  49. # This is undefined when crosscompiling...
  50. $(SED) 's,.*HAVE_PROC_UPTIME.*,#define HAVE_PROC_UPTIME 1,g' \
  51. $(COREUTILS_DIR)/config.h
  52. touch $(COREUTILS_DIR)/.configured
  53. $(COREUTILS_DIR)/$(COREUTILS_BINARY): $(COREUTILS_DIR)/.configured
  54. $(MAKE) CC=$(TARGET_CC) -C $(COREUTILS_DIR)
  55. rm -f $(TARGET_DIR)/$(COREUTILS_TARGET_BINARY)
  56. $(TARGET_DIR)/$(COREUTILS_TARGET_BINARY): $(COREUTILS_DIR)/$(COREUTILS_BINARY)
  57. $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(COREUTILS_DIR) install
  58. # some things go in root rather than usr
  59. for f in $(BIN_PROGS); do \
  60. mv $(TARGET_DIR)/usr/bin/$$f $(TARGET_DIR)/bin/$$f; \
  61. done
  62. # link for archaic shells
  63. ln -fs test $(TARGET_DIR)/usr/bin/[
  64. # gnu thinks chroot is in bin, debian thinks it's in sbin
  65. mv $(TARGET_DIR)/usr/bin/chroot $(TARGET_DIR)/usr/sbin/chroot
  66. $(STRIP) $(TARGET_DIR)/usr/sbin/chroot > /dev/null 2>&1
  67. rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \
  68. $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc
  69. #If both coreutils and busybox are selected, make certain coreutils
  70. #wins the fight over who gets to have their utils actually installed
  71. ifeq ($(BR2_PACKAGE_BUSYBOX),y)
  72. coreutils: uclibc busybox $(TARGET_DIR)/$(COREUTILS_TARGET_BINARY)
  73. else
  74. coreutils: uclibc $(TARGET_DIR)/$(COREUTILS_TARGET_BINARY)
  75. endif
  76. coreutils-clean:
  77. $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(COREUTILS_DIR) uninstall
  78. -$(MAKE) -C $(COREUTILS_DIR) clean
  79. coreutils-dirclean:
  80. rm -rf $(COREUTILS_DIR)
  81. #############################################################
  82. #
  83. # Toplevel Makefile options
  84. #
  85. #############################################################
  86. ifeq ($(strip $(BR2_PACKAGE_COREUTILS)),y)
  87. TARGETS+=coreutils
  88. endif