package-defaults.mk 3.8 KB

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