build: add optional dependency on libssp to all non-kernel packages
[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: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 DISABLE_NLS:=--disable-nls
71
72 CONFIGURE_PREFIX:=/usr
73 CONFIGURE_ARGS = \
74 --target=$(GNU_TARGET_NAME) \
75 --host=$(GNU_TARGET_NAME) \
76 --build=$(GNU_HOST_NAME) \
77 --program-prefix="" \
78 --program-suffix="" \
79 --prefix=$(CONFIGURE_PREFIX) \
80 --exec-prefix=$(CONFIGURE_PREFIX) \
81 --bindir=$(CONFIGURE_PREFIX)/bin \
82 --sbindir=$(CONFIGURE_PREFIX)/sbin \
83 --libexecdir=$(CONFIGURE_PREFIX)/lib \
84 --sysconfdir=/etc \
85 --datadir=$(CONFIGURE_PREFIX)/share \
86 --localstatedir=/var \
87 --mandir=$(CONFIGURE_PREFIX)/man \
88 --infodir=$(CONFIGURE_PREFIX)/info \
89 $(DISABLE_NLS) \
90 $(DISABLE_LARGEFILE) \
91 $(DISABLE_IPV6)
92
93 CONFIGURE_VARS = \
94 $(TARGET_CONFIGURE_OPTS) \
95 CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
96 CXXFLAGS="$(TARGET_CXXFLAGS) $(EXTRA_CFLAGS)" \
97 CPPFLAGS="$(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" \
98 LDFLAGS="$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)" \
99
100 CONFIGURE_PATH = .
101 CONFIGURE_CMD = ./configure
102
103 replace_script=$(FIND) $(1) -name $(2) | $(XARGS) chmod u+w; \
104 $(FIND) $(1) -name $(2) | $(XARGS) -n1 cp --remove-destination \
105 $(SCRIPT_DIR)/$(2);
106
107 define Build/Configure/Default
108 (cd $(PKG_BUILD_DIR)/$(CONFIGURE_PATH)/$(strip $(3)); \
109 if [ -x $(CONFIGURE_CMD) ]; then \
110 $(call replace_script,$(PKG_BUILD_DIR)/$(3),config.guess) \
111 $(call replace_script,$(PKG_BUILD_DIR)/$(3),config.sub) \
112 $(CONFIGURE_VARS) \
113 $(2) \
114 $(CONFIGURE_CMD) \
115 $(CONFIGURE_ARGS) \
116 $(1); \
117 fi; \
118 )
119 endef
120
121 MAKE_VARS = \
122 CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" \
123 CXXFLAGS="$(TARGET_CXXFLAGS) $(EXTRA_CXXFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" \
124 LDFLAGS="$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)"
125
126 MAKE_FLAGS = \
127 $(TARGET_CONFIGURE_OPTS) \
128 CROSS="$(TARGET_CROSS)" \
129 ARCH="$(ARCH)"
130
131 MAKE_INSTALL_FLAGS = \
132 $(MAKE_FLAGS) \
133 DESTDIR="$(PKG_INSTALL_DIR)"
134
135 MAKE_PATH = .
136
137 define Build/Compile/Default
138 +$(MAKE_VARS) \
139 $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/$(MAKE_PATH) \
140 $(MAKE_FLAGS) \
141 $(1);
142 endef
143
144 define Build/Install/Default
145 $(MAKE_VARS) \
146 $(MAKE) -C $(PKG_BUILD_DIR)/$(MAKE_PATH) \
147 $(MAKE_INSTALL_FLAGS) \
148 $(if $(1), $(1), install);
149 endef
150
151 define Build/Dist/Default
152 $(call Build/Compile/Default, DESTDIR="$(PKG_BUILD_DIR)/tmp" CC="$(TARGET_CC)" dist)
153 endef
154
155 define Build/DistCheck/Default
156 $(call Build/Compile/Default, DESTDIR="$(PKG_BUILD_DIR)/tmp" CC="$(TARGET_CC)" distcheck)
157 endef