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