coreutils.mk 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. ac_cv_func_strtod=yes \
  25. ./configure \
  26. --target=$(GNU_TARGET_NAME) \
  27. --host=$(GNU_TARGET_NAME) \
  28. --build=$(GNU_HOST_NAME) \
  29. --prefix=/usr \
  30. --exec-prefix=/usr \
  31. --bindir=/usr/bin \
  32. --sbindir=/usr/sbin \
  33. --libexecdir=/usr/lib \
  34. --sysconfdir=/etc \
  35. --datadir=/usr/share \
  36. --localstatedir=/var \
  37. --mandir=/usr/man \
  38. --infodir=/usr/info \
  39. $(DISABLE_NLS) \
  40. $(DISABLE_LARGEFILE) \
  41. --disable-rpath \
  42. --disable-dependency-tracking \
  43. );
  44. #Fix up the max number of open files per process, which apparently
  45. # is not set when cross compiling
  46. $(SED) 's,.*UTILS_OPEN_MAX.*,#define UTILS_OPEN_MAX 1019,g' \
  47. $(COREUTILS_DIR)/config.h
  48. # This is undefined when crosscompiling...
  49. $(SED) 's,.*HAVE_PROC_UPTIME.*,#define HAVE_PROC_UPTIME 1,g' \
  50. $(COREUTILS_DIR)/config.h
  51. touch $(COREUTILS_DIR)/.configured
  52. $(COREUTILS_DIR)/$(COREUTILS_BINARY): $(COREUTILS_DIR)/.configured
  53. $(MAKE) CC=$(TARGET_CC) -C $(COREUTILS_DIR)
  54. rm -f $(TARGET_DIR)/$(COREUTILS_TARGET_BINARY)
  55. $(TARGET_DIR)/$(COREUTILS_TARGET_BINARY): $(COREUTILS_DIR)/$(COREUTILS_BINARY)
  56. $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(COREUTILS_DIR) install
  57. # some things go in root rather than usr
  58. for f in $(BIN_PROGS); do \
  59. mv $(TARGET_DIR)/usr/bin/$$f $(TARGET_DIR)/bin/$$f; \
  60. done
  61. # link for archaic shells
  62. ln -fs test $(TARGET_DIR)/usr/bin/[
  63. # gnu thinks chroot is in bin, debian thinks it's in sbin
  64. mv $(TARGET_DIR)/usr/bin/chroot $(TARGET_DIR)/usr/sbin/chroot
  65. $(STRIP) $(TARGET_DIR)/usr/sbin/chroot > /dev/null 2>&1
  66. rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \
  67. $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc
  68. coreutils: uclibc $(TARGET_DIR)/$(COREUTILS_TARGET_BINARY)
  69. coreutils-clean:
  70. $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(COREUTILS_DIR) uninstall
  71. -$(MAKE) -C $(COREUTILS_DIR) clean
  72. coreutils-dirclean:
  73. rm -rf $(COREUTILS_DIR)