util-linux.mk 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. ################################################################################
  2. #
  3. # util-linux
  4. #
  5. ################################################################################
  6. UTIL_LINUX_VERSION = $(UTIL_LINUX_VERSION_MAJOR).1
  7. UTIL_LINUX_VERSION_MAJOR = 2.25
  8. UTIL_LINUX_SOURCE = util-linux-$(UTIL_LINUX_VERSION).tar.xz
  9. UTIL_LINUX_SITE = $(BR2_KERNEL_MIRROR)/linux/utils/util-linux/v$(UTIL_LINUX_VERSION_MAJOR)
  10. # README.licensing claims that some files are GPLv2-only, but this is not true.
  11. # Some files are GPLv3+ but only in tests.
  12. UTIL_LINUX_LICENSE = GPLv2+, BSD-4c, libblkid and libmount LGPLv2.1+, libuuid BSD-3c
  13. UTIL_LINUX_LICENSE_FILES = README.licensing Documentation/licenses/COPYING.GPLv2 Documentation/licenses/COPYING.UCB Documentation/licenses/COPYING.LGPLv2.1 Documentation/licenses/COPYING.BSD-3
  14. UTIL_LINUX_AUTORECONF = YES
  15. UTIL_LINUX_INSTALL_STAGING = YES
  16. UTIL_LINUX_DEPENDENCIES = host-pkgconf
  17. UTIL_LINUX_CONF_ENV = scanf_cv_type_modifier=no
  18. UTIL_LINUX_CONF_OPT += \
  19. --disable-rpath \
  20. --disable-makeinstall-chown \
  21. --disable-bash-completion \
  22. --without-python
  23. # We don't want the host-busybox dependency to be added automatically
  24. HOST_UTIL_LINUX_DEPENDENCIES = host-pkgconf
  25. # We also don't want the host-python dependency
  26. HOST_UTIL_LINUX_CONF_OPT = --without-python
  27. # If both util-linux and busybox are selected, make certain util-linux
  28. # wins the fight over who gets to have their utils actually installed
  29. ifeq ($(BR2_PACKAGE_BUSYBOX),y)
  30. UTIL_LINUX_DEPENDENCIES += busybox
  31. endif
  32. ifeq ($(BR2_PACKAGE_NCURSES),y)
  33. UTIL_LINUX_DEPENDENCIES += ncurses
  34. else
  35. UTIL_LINUX_CONF_OPT += --without-ncurses
  36. endif
  37. ifeq ($(BR2_NEEDS_GETTEXT_IF_LOCALE),y)
  38. UTIL_LINUX_DEPENDENCIES += gettext
  39. UTIL_LINUX_MAKE_OPTS += LIBS=-lintl
  40. endif
  41. ifeq ($(BR2_PACKAGE_LIBCAP_NG),y)
  42. UTIL_LINUX_DEPENDENCIES += libcap-ng
  43. endif
  44. # Used by cramfs utils
  45. UTIL_LINUX_DEPENDENCIES += $(if $(BR2_PACKAGE_ZLIB),zlib)
  46. # Used by login-utils
  47. UTIL_LINUX_DEPENDENCIES += $(if $(BR2_PACKAGE_LINUX_PAM),linux-pam)
  48. # Disable/Enable utilities
  49. UTIL_LINUX_CONF_OPT += \
  50. $(if $(BR2_PACKAGE_UTIL_LINUX_AGETTY),--enable-agetty,--disable-agetty) \
  51. $(if $(BR2_PACKAGE_UTIL_LINUX_ARCH),--enable-arch,--disable-arch) \
  52. $(if $(BR2_PACKAGE_UTIL_LINUX_CHFN_CHSH),--enable-chfn-chsh,--disable-chfn-chsh) \
  53. $(if $(BR2_PACKAGE_UTIL_LINUX_CRAMFS),--enable-cramfs,--disable-cramfs) \
  54. $(if $(BR2_PACKAGE_UTIL_LINUX_DDATE),--enable-ddate,--disable-ddate) \
  55. $(if $(BR2_PACKAGE_UTIL_LINUX_EJECT),--enable-eject,--disable-eject) \
  56. $(if $(BR2_PACKAGE_UTIL_LINUX_FALLOCATE),--enable-fallocate,--disable-fallocate) \
  57. $(if $(BR2_PACKAGE_UTIL_LINUX_FSCK),--enable-fsck,--disable-fsck) \
  58. $(if $(BR2_PACKAGE_UTIL_LINUX_KILL),--enable-kill,--disable-kill) \
  59. $(if $(BR2_PACKAGE_UTIL_LINUX_LIBBLKID),--enable-libblkid,--disable-libblkid) \
  60. $(if $(BR2_PACKAGE_UTIL_LINUX_LIBMOUNT),--enable-libmount,--disable-libmount) \
  61. $(if $(BR2_PACKAGE_UTIL_LINUX_LIBUUID),--enable-libuuid,--disable-libuuid) \
  62. $(if $(BR2_PACKAGE_UTIL_LINUX_LOGIN_UTILS),--enable-last --enable-login --enable-su --enable-sulogin,--disable-last --disable-login --disable-su --disable-sulogin) \
  63. $(if $(BR2_PACKAGE_UTIL_LINUX_LOSETUP),--enable-losetup,--disable-losetup) \
  64. $(if $(BR2_PACKAGE_UTIL_LINUX_MESG),--enable-mesg,--disable-mesg) \
  65. $(if $(BR2_PACKAGE_UTIL_LINUX_MOUNT),--enable-mount,--disable-mount) \
  66. $(if $(BR2_PACKAGE_UTIL_LINUX_NEWGRP),--enable-newgrp,--disable-newgrp) \
  67. $(if $(BR2_PACKAGE_UTIL_LINUX_PARTX),--enable-partx,--disable-partx) \
  68. $(if $(BR2_PACKAGE_UTIL_LINUX_PIVOT_ROOT),--enable-pivot_root,--disable-pivot_root) \
  69. $(if $(BR2_PACKAGE_UTIL_LINUX_RAW),--enable-raw,--disable-raw) \
  70. $(if $(BR2_PACKAGE_UTIL_LINUX_RENAME),--enable-rename,--disable-rename) \
  71. $(if $(BR2_PACKAGE_UTIL_LINUX_RESET),--enable-reset,--disable-reset) \
  72. $(if $(BR2_PACKAGE_UTIL_LINUX_SCHEDUTILS),--enable-schedutils,--disable-schedutils) \
  73. $(if $(BR2_PACKAGE_UTIL_LINUX_SWITCH_ROOT),--enable-switch_root,--disable-switch_root) \
  74. $(if $(BR2_PACKAGE_UTIL_LINUX_UNSHARE),--enable-unshare,--disable-unshare) \
  75. $(if $(BR2_PACKAGE_UTIL_LINUX_UTMPDUMP),--enable-utmpdump,--disable-utmpdump) \
  76. $(if $(BR2_PACKAGE_UTIL_LINUX_UUIDD),--enable-uuidd,--disable-uuidd) \
  77. $(if $(BR2_PACKAGE_UTIL_LINUX_VIPW),--enable-vipw,--disable-vipw) \
  78. $(if $(BR2_PACKAGE_UTIL_LINUX_WALL),--enable-wall,--disable-wall) \
  79. $(if $(BR2_PACKAGE_UTIL_LINUX_WRITE),--enable-write,--disable-write)
  80. # In the host version of util-linux, we so far only require libuuid,
  81. # and none of the util-linux utilities, so we disable all of them.
  82. HOST_UTIL_LINUX_CONF_OPT += \
  83. --enable-libuuid \
  84. --disable-libblkid --disable-libmount \
  85. --disable-all-programs --without-ncurses
  86. # Avoid building the tools if they are disabled since we can't install on
  87. # a per-directory basis.
  88. ifeq ($(BR2_PACKAGE_UTIL_LINUX_BINARIES),)
  89. define UTIL_LINUX_DISABLE_TOOLS
  90. $(SED) '/schedutils/d' -e '/text-utils/d' -e '/term-utils/d' \
  91. -e '/login-utils/d' -e '/mount-deprecated/d' \
  92. -e '/sys-utils/d' -e '/misc-utils/d' -e '/disk-utils/d' \
  93. -e '/fdisks/d' $(@D)/Makefile.am
  94. endef
  95. UTIL_LINUX_PRE_PATCH_HOOKS += UTIL_LINUX_DISABLE_TOOLS
  96. endif
  97. # Install PAM configuration files
  98. ifeq ($(BR2_PACKAGE_UTIL_LINUX_LOGIN_UTILS),y)
  99. define UTIL_LINUX_INSTALL_PAMFILES
  100. $(INSTALL) -m 0644 package/util-linux/login.pam \
  101. $(TARGET_DIR)/etc/pam.d/login
  102. $(INSTALL) -m 0644 package/util-linux/su.pam \
  103. $(TARGET_DIR)/etc/pam.d/su
  104. $(INSTALL) -m 0644 package/util-linux/su.pam \
  105. $(TARGET_DIR)/etc/pam.d/su-l
  106. endef
  107. endif
  108. UTIL_LINUX_POST_INSTALL_TARGET_HOOKS += UTIL_LINUX_INSTALL_PAMFILES
  109. # Install agetty->getty symlink to avoid breakage when there's no busybox
  110. ifeq ($(BR2_PACKAGE_UTIL_LINUX_AGETTY),y)
  111. ifeq ($(BR2_PACKAGE_BUSYBOX),)
  112. define UTIL_LINUX_GETTY_SYMLINK
  113. ln -sf agetty $(TARGET_DIR)/sbin/getty
  114. endef
  115. endif
  116. endif
  117. UTIL_LINUX_POST_INSTALL_TARGET_HOOKS += UTIL_LINUX_GETTY_SYMLINK
  118. $(eval $(autotools-package))
  119. $(eval $(host-autotools-package))
  120. # MKINSTALLDIRS comes from tweaked m4/nls.m4, but autoreconf uses staging
  121. # one, so it disappears
  122. UTIL_LINUX_INSTALL_STAGING_OPT += MKINSTALLDIRS=$(@D)/config/mkinstalldirs
  123. UTIL_LINUX_INSTALL_TARGET_OPTS += MKINSTALLDIRS=$(@D)/config/mkinstalldirs
  124. HOST_UTIL_LINUX_INSTALL_OPTS += MKINSTALLDIRS=$(@D)/config/mkinstalldirs