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