replace a few unnecessary $(shell) calls
[openwrt/svn-archive/archive.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 PKGARCH:=$(ARCH)
27 PRIORITY:=optional
28 DEFAULT:=
29 MENU:=
30 SUBMENU:=
31 SUBMENUDEP:=
32 TITLE:=
33 KCONFIG:=
34 BUILDONLY:=
35 URL:=
36 endef
37
38 Build/Patch:=$(Build/Patch/Default)
39 ifneq ($(strip $(PKG_UNPACK)),)
40 define Build/Prepare/Default
41 $(PKG_UNPACK)
42 $(Build/Patch)
43 endef
44 endif
45
46 export PKG_CONFIG_PATH=$(STAGING_DIR)/usr/lib/pkgconfig:$(STAGING_DIR_HOST)/usr/lib/pkgconfig
47 export PKG_CONFIG_LIBDIR=$(STAGING_DIR)/usr/lib/pkgconfig
48
49 CONFIGURE_PREFIX:=/usr
50 CONFIGURE_ARGS = \
51 --target=$(GNU_TARGET_NAME) \
52 --host=$(GNU_TARGET_NAME) \
53 --build=$(GNU_HOST_NAME) \
54 --program-prefix="" \
55 --program-suffix="" \
56 --prefix=$(CONFIGURE_PREFIX) \
57 --exec-prefix=$(CONFIGURE_PREFIX) \
58 --bindir=$(CONFIGURE_PREFIX)/bin \
59 --sbindir=$(CONFIGURE_PREFIX)/sbin \
60 --libexecdir=$(CONFIGURE_PREFIX)/lib \
61 --sysconfdir=/etc \
62 --datadir=$(CONFIGURE_PREFIX)/share \
63 --localstatedir=/var \
64 --mandir=$(CONFIGURE_PREFIX)/man \
65 --infodir=$(CONFIGURE_PREFIX)/info \
66 $(DISABLE_NLS)
67
68 CONFIGURE_VARS = \
69 $(TARGET_CONFIGURE_OPTS) \
70 CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
71 CXXFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
72 CPPFLAGS="$(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" \
73 LDFLAGS="$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)" \
74 PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" \
75 PKG_CONFIG_LIBDIR="$(PKG_CONFIG_LIBDIR)"
76
77 CONFIGURE_PATH = .
78 CONFIGURE_CMD = ./configure
79
80 replace_script=$(FIND) $(1) -name $(2) | $(XARGS) chmod u+w; $(FIND) $(1) -name $(2) | $(XARGS) -n1 cp $(SCRIPT_DIR)/$(2);
81
82 define Build/Configure/Default
83 (cd $(PKG_BUILD_DIR)/$(CONFIGURE_PATH)/$(strip $(3)); \
84 if [ -x $(CONFIGURE_CMD) ]; then \
85 $(call replace_script,$(PKG_BUILD_DIR)/$(3),config.guess) \
86 $(call replace_script,$(PKG_BUILD_DIR)/$(3),config.sub) \
87 $(CONFIGURE_VARS) \
88 $(2) \
89 $(CONFIGURE_CMD) \
90 $(CONFIGURE_ARGS) \
91 $(1); \
92 fi; \
93 )
94 endef
95
96 MAKE_VARS = \
97 CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" \
98 CXXFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" \
99 LDFLAGS="$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)"
100
101 MAKE_FLAGS = \
102 $(TARGET_CONFIGURE_OPTS) \
103 CROSS="$(TARGET_CROSS)" \
104 ARCH="$(ARCH)"
105
106 MAKE_INSTALL_FLAGS = \
107 $(MAKE_FLAGS) \
108 DESTDIR="$(PKG_INSTALL_DIR)"
109
110 MAKE_PATH = .
111
112 define Build/Compile/Default
113 $(MAKE_VARS) \
114 $(MAKE) -C $(PKG_BUILD_DIR)/$(MAKE_PATH) \
115 $(MAKE_FLAGS) \
116 $(1);
117 endef
118
119 define Build/Install/Default
120 $(MAKE_VARS) \
121 $(MAKE) -C $(PKG_BUILD_DIR)/$(MAKE_PATH) \
122 $(MAKE_INSTALL_FLAGS) \
123 $(1) install;
124 endef