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