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