1
0

package-defaults.mk 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. # SPDX-License-Identifier: GPL-2.0-only
  2. #
  3. # Copyright (C) 2006-2020 OpenWrt.org
  4. PKG_DEFAULT_DEPENDS = +libc
  5. ifneq ($(PKG_NAME),toolchain)
  6. PKG_FIXUP_DEPENDS = $(if $(filter kmod-%,$(1)),$(2),$(PKG_DEFAULT_DEPENDS) $(filter-out $(PKG_DEFAULT_DEPENDS),$(2)))
  7. else
  8. PKG_FIXUP_DEPENDS = $(2)
  9. endif
  10. define Package/Default
  11. CONFIGFILE:=
  12. SECTION:=opt
  13. CATEGORY:=Extra packages
  14. DEPENDS:=
  15. MDEPENDS:=
  16. CONFLICTS:=
  17. PROVIDES:=
  18. EXTRA_DEPENDS:=
  19. MAINTAINER:=$(PKG_MAINTAINER)
  20. SOURCE:=$(patsubst $(TOPDIR)/%,%,$(CURDIR))
  21. ifneq ($(PKG_VERSION),)
  22. ifneq ($(PKG_RELEASE),)
  23. VERSION:=$(PKG_VERSION)-$(PKG_RELEASE)
  24. else
  25. VERSION:=$(PKG_VERSION)
  26. endif
  27. else
  28. VERSION:=$(PKG_RELEASE)
  29. endif
  30. ABI_VERSION:=
  31. ifneq ($(PKG_FLAGS),)
  32. PKGFLAGS:=$(PKG_FLAGS)
  33. else
  34. PKGFLAGS:=
  35. endif
  36. ifneq ($(ARCH_PACKAGES),)
  37. PKGARCH:=$(ARCH_PACKAGES)
  38. else
  39. PKGARCH:=$(BOARD)
  40. endif
  41. DEFAULT:=
  42. MENU:=
  43. SUBMENU:=
  44. SUBMENUDEP:=
  45. TITLE:=
  46. KCONFIG:=
  47. BUILDONLY:=
  48. HIDDEN:=
  49. URL:=
  50. VARIANT:=
  51. DEFAULT_VARIANT:=
  52. USERID:=
  53. ALTERNATIVES:=
  54. LICENSE:=$(PKG_LICENSE)
  55. LICENSE_FILES:=$(PKG_LICENSE_FILES)
  56. FILE_MODES:=$(PKG_FILE_MODES)
  57. endef
  58. Build/Patch:=$(Build/Patch/Default)
  59. ifneq ($(strip $(PKG_UNPACK)),)
  60. define Build/Prepare/Default
  61. $(PKG_UNPACK)
  62. [ ! -d ./src/ ] || $(CP) ./src/. $(PKG_BUILD_DIR)
  63. $(Build/Patch)
  64. endef
  65. endif
  66. EXTRA_CXXFLAGS = $(EXTRA_CFLAGS)
  67. ifeq ($(CONFIG_BUILD_NLS),y)
  68. DISABLE_NLS:=
  69. else
  70. DISABLE_NLS:=--disable-nls
  71. endif
  72. CONFIGURE_PREFIX:=/usr
  73. CONFIGURE_ARGS = \
  74. --target=$(GNU_TARGET_NAME) \
  75. --host=$(GNU_TARGET_NAME) \
  76. --build=$(GNU_HOST_NAME) \
  77. --disable-dependency-tracking \
  78. --program-prefix="" \
  79. --program-suffix="" \
  80. --prefix=$(CONFIGURE_PREFIX) \
  81. --exec-prefix=$(CONFIGURE_PREFIX) \
  82. --bindir=$(CONFIGURE_PREFIX)/bin \
  83. --sbindir=$(CONFIGURE_PREFIX)/sbin \
  84. --libexecdir=$(CONFIGURE_PREFIX)/lib \
  85. --sysconfdir=/etc \
  86. --datadir=$(CONFIGURE_PREFIX)/share \
  87. --localstatedir=/var \
  88. --mandir=$(CONFIGURE_PREFIX)/man \
  89. --infodir=$(CONFIGURE_PREFIX)/info \
  90. $(DISABLE_NLS) \
  91. $(DISABLE_IPV6)
  92. CONFIGURE_VARS = \
  93. $(TARGET_CONFIGURE_OPTS) \
  94. CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
  95. CXXFLAGS="$(TARGET_CXXFLAGS) $(EXTRA_CXXFLAGS)" \
  96. CPPFLAGS="$(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" \
  97. LDFLAGS="$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)" \
  98. CONFIGURE_PATH = .
  99. CONFIGURE_CMD = ./configure
  100. replace_script=$(FIND) $(1) -name $(2) | $(XARGS) chmod u+w; \
  101. $(FIND) $(1) -name $(2) | $(XARGS) -n1 cp --remove-destination \
  102. $(SCRIPT_DIR)/$(2);
  103. define Build/Configure/Default
  104. (cd $(PKG_BUILD_DIR)/$(CONFIGURE_PATH)/$(strip $(3)); \
  105. if [ -x $(CONFIGURE_CMD) ]; then \
  106. $(call replace_script,$(PKG_BUILD_DIR)/$(3),config.guess) \
  107. $(call replace_script,$(PKG_BUILD_DIR)/$(3),config.sub) \
  108. $(CONFIGURE_VARS) \
  109. $(2) \
  110. $(CONFIGURE_CMD) \
  111. $(CONFIGURE_ARGS) \
  112. $(1); \
  113. fi; \
  114. )
  115. endef
  116. MAKE_VARS = \
  117. CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" \
  118. CXXFLAGS="$(TARGET_CXXFLAGS) $(EXTRA_CXXFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" \
  119. LDFLAGS="$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)"
  120. MAKE_FLAGS = \
  121. $(TARGET_CONFIGURE_OPTS) \
  122. CROSS="$(TARGET_CROSS)" \
  123. ARCH="$(ARCH)"
  124. MAKE_INSTALL_FLAGS = \
  125. $(MAKE_FLAGS) \
  126. DESTDIR="$(PKG_INSTALL_DIR)"
  127. MAKE_PATH ?= .
  128. define Build/Compile/Default
  129. +$(MAKE_VARS) \
  130. $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/$(MAKE_PATH) \
  131. $(MAKE_FLAGS) \
  132. $(1);
  133. endef
  134. define Build/Install/Default
  135. $(MAKE_VARS) \
  136. $(MAKE) -C $(PKG_BUILD_DIR)/$(MAKE_PATH) \
  137. $(MAKE_INSTALL_FLAGS) \
  138. $(if $(1), $(1), install);
  139. endef
  140. define Build/Dist/Default
  141. $(call Build/Compile/Default, DESTDIR="$(PKG_BUILD_DIR)/tmp" CC="$(TARGET_CC)" dist)
  142. endef
  143. define Build/DistCheck/Default
  144. $(call Build/Compile/Default, DESTDIR="$(PKG_BUILD_DIR)/tmp" CC="$(TARGET_CC)" distcheck)
  145. endef