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