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