coreutils.mk 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #############################################################
  2. #
  3. # coreutils
  4. #
  5. #############################################################
  6. COREUTILS_SOURCE:=coreutils-4.5.6.tar.bz2
  7. COREUTILS_SITE:=ftp://alpha.gnu.org/gnu/coreutils/
  8. COREUTILS_CAT:=bzcat
  9. COREUTILS_DIR:=$(BUILD_DIR)/coreutils-4.5.6
  10. COREUTILS_BINARY:=src/cat
  11. COREUTILS_TARGET_BINARY:=bin/cat
  12. BIN_PROGS:=cat chgrp chmod chown cp date dd df dir echo false ln ls mkdir \
  13. 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. ./configure \
  24. --target=$(GNU_TARGET_NAME) \
  25. --host=$(GNU_TARGET_NAME) \
  26. --build=$(GNU_HOST_NAME) \
  27. --prefix=/usr \
  28. --exec-prefix=/usr \
  29. --bindir=/usr/bin \
  30. --sbindir=/usr/sbin \
  31. --libexecdir=/usr/lib \
  32. --sysconfdir=/etc \
  33. --datadir=/usr/share \
  34. --localstatedir=/var \
  35. --mandir=/usr/man \
  36. --infodir=/usr/info \
  37. --disable-nls \
  38. );
  39. #Fix up the max number of open files per process, which apparently
  40. # is not set when cross compiling
  41. perl -i -p -e 's,.*UTILS_OPEN_MAX.*,#define UTILS_OPEN_MAX 1019,g' \
  42. $(COREUTILS_DIR)/config.h
  43. touch $(COREUTILS_DIR)/.configured
  44. $(COREUTILS_DIR)/$(COREUTILS_BINARY): $(COREUTILS_DIR)/.configured
  45. $(MAKE) CC=$(TARGET_CC) -C $(COREUTILS_DIR)
  46. $(TARGET_DIR)/$(COREUTILS_TARGET_BINARY): $(COREUTILS_DIR)/$(COREUTILS_BINARY)
  47. $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(COREUTILS_DIR) install
  48. # some things go in root rather than usr
  49. for f in $(BIN_PROGS); do \
  50. mv $(TARGET_DIR)/usr/bin/$$f $(TARGET_DIR)/bin/$$f; \
  51. done
  52. # link for archaic shells
  53. ln -fs test $(TARGET_DIR)/usr/bin/[
  54. # gnu thinks chroot is in bin, debian thinks it's in sbin
  55. mv $(TARGET_DIR)/usr/bin/chroot $(TARGET_DIR)/usr/sbin/chroot
  56. rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \
  57. $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc
  58. coreutils: uclibc $(TARGET_DIR)/$(COREUTILS_TARGET_BINARY)
  59. coreutils-clean:
  60. $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(COREUTILS_DIR) uninstall
  61. -$(MAKE) -C $(COREUTILS_DIR) clean
  62. coreutils-dirclean:
  63. rm -rf $(COREUTILS_DIR)