a5e9fbe9153b9458ae3da4998a9bc3bc6fb635b7
[openwrt/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 +(SSP_SUPPORT&&!USE_MUSL):libssp +USE_GLIBC:librt +USE_GLIBC: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 CONFLICTS:=
23 PROVIDES:=
24 EXTRA_DEPENDS:=
25 MAINTAINER:=$(PKG_MAINTAINER)
26 SOURCE:=$(patsubst $(TOPDIR)/%,%,$(CURDIR))
27 ifneq ($(PKG_VERSION),)
28 ifneq ($(PKG_RELEASE),)
29 VERSION:=$(PKG_VERSION)-$(PKG_RELEASE)
30 else
31 VERSION:=$(PKG_VERSION)
32 endif
33 else
34 VERSION:=$(PKG_RELEASE)
35 endif
36 ABI_VERSION:=
37 ifneq ($(PKG_FLAGS),)
38 PKGFLAGS:=$(PKG_FLAGS)
39 else
40 PKGFLAGS:=
41 endif
42 ifneq ($(ARCH_PACKAGES),)
43 PKGARCH:=$(ARCH_PACKAGES)
44 else
45 PKGARCH:=$(BOARD)
46 endif
47 DEFAULT:=
48 MENU:=
49 SUBMENU:=
50 SUBMENUDEP:=
51 TITLE:=
52 KCONFIG:=
53 BUILDONLY:=
54 HIDDEN:=
55 URL:=
56 VARIANT:=
57 DEFAULT_VARIANT:=
58 USERID:=
59 endef
60
61 Build/Patch:=$(Build/Patch/Default)
62 ifneq ($(strip $(PKG_UNPACK)),)
63 define Build/Prepare/Default
64 $(PKG_UNPACK)
65 $(Build/Patch)
66 endef
67 endif
68
69 EXTRA_CXXFLAGS = $(EXTRA_CFLAGS)
70 ifeq ($(CONFIG_BUILD_NLS),y)
71 DISABLE_NLS:=
72 else
73 DISABLE_NLS:=--disable-nls
74 endif
75
76 CONFIGURE_PREFIX:=/usr
77 CONFIGURE_ARGS = \
78 --target=$(GNU_TARGET_NAME) \
79 --host=$(GNU_TARGET_NAME) \
80 --build=$(GNU_HOST_NAME) \
81 --program-prefix="" \
82 --program-suffix="" \
83 --prefix=$(CONFIGURE_PREFIX) \
84 --exec-prefix=$(CONFIGURE_PREFIX) \
85 --bindir=$(CONFIGURE_PREFIX)/bin \
86 --sbindir=$(CONFIGURE_PREFIX)/sbin \
87 --libexecdir=$(CONFIGURE_PREFIX)/lib \
88 --sysconfdir=/etc \
89 --datadir=$(CONFIGURE_PREFIX)/share \
90 --localstatedir=/var \
91 --mandir=$(CONFIGURE_PREFIX)/man \
92 --infodir=$(CONFIGURE_PREFIX)/info \
93 $(DISABLE_NLS) \
94 $(DISABLE_LARGEFILE) \
95 $(DISABLE_IPV6)
96
97 CONFIGURE_VARS = \
98 $(TARGET_CONFIGURE_OPTS) \
99 CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
100 CXXFLAGS="$(TARGET_CXXFLAGS) $(EXTRA_CFLAGS)" \
101 CPPFLAGS="$(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" \
102 LDFLAGS="$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)" \
103
104 CONFIGURE_PATH = .
105 CONFIGURE_CMD = ./configure
106
107 replace_script=$(FIND) $(1) -name $(2) | $(XARGS) chmod u+w; \
108 $(FIND) $(1) -name $(2) | $(XARGS) -n1 cp --remove-destination \
109 $(SCRIPT_DIR)/$(2);
110
111 define Build/Configure/Default
112 (cd $(PKG_BUILD_DIR)/$(CONFIGURE_PATH)/$(strip $(3)); \
113 if [ -x $(CONFIGURE_CMD) ]; then \
114 $(call replace_script,$(PKG_BUILD_DIR)/$(3),config.guess) \
115 $(call replace_script,$(PKG_BUILD_DIR)/$(3),config.sub) \
116 $(CONFIGURE_VARS) \
117 $(2) \
118 $(CONFIGURE_CMD) \
119 $(CONFIGURE_ARGS) \
120 $(1); \
121 fi; \
122 )
123 endef
124
125 MAKE_VARS = \
126 CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" \
127 CXXFLAGS="$(TARGET_CXXFLAGS) $(EXTRA_CXXFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" \
128 LDFLAGS="$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)"
129
130 MAKE_FLAGS = \
131 $(TARGET_CONFIGURE_OPTS) \
132 CROSS="$(TARGET_CROSS)" \
133 ARCH="$(ARCH)"
134
135 MAKE_INSTALL_FLAGS = \
136 $(MAKE_FLAGS) \
137 DESTDIR="$(PKG_INSTALL_DIR)"
138
139 MAKE_PATH = .
140
141 define Build/Compile/Default
142 +$(MAKE_VARS) \
143 $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/$(MAKE_PATH) \
144 $(MAKE_FLAGS) \
145 $(1);
146 endef
147
148 define Build/Install/Default
149 $(MAKE_VARS) \
150 $(MAKE) -C $(PKG_BUILD_DIR)/$(MAKE_PATH) \
151 $(MAKE_INSTALL_FLAGS) \
152 $(if $(1), $(1), install);
153 endef
154
155 define Build/Dist/Default
156 $(call Build/Compile/Default, DESTDIR="$(PKG_BUILD_DIR)/tmp" CC="$(TARGET_CC)" dist)
157 endef
158
159 define Build/DistCheck/Default
160 $(call Build/Compile/Default, DESTDIR="$(PKG_BUILD_DIR)/tmp" CC="$(TARGET_CC)" distcheck)
161 endef