d6adb1a17a011e5526771e548048a8fced0861f4
[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   PROVIDES:=
14   EXTRA_DEPENDS:=
15   MAINTAINER:=OpenWrt Developers Team <openwrt-devel@openwrt.org>
16   SOURCE:=$(patsubst $(TOPDIR)/%,%,${shell pwd})
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 endef
35
36 Build/Patch:=$(Build/Patch/Default)
37 ifneq ($(strip $(PKG_UNPACK)),)
38   define Build/Prepare/Default
39         $(PKG_UNPACK)
40         $(Build/Patch)
41         $(if $(QUILT),touch $(PKG_BUILD_DIR)/.quilt_used)
42   endef
43 endif
44
45 CONFIGURE_ARGS = \
46                 --target=$(GNU_TARGET_NAME) \
47                 --host=$(GNU_TARGET_NAME) \
48                 --build=$(GNU_HOST_NAME) \
49                 --program-prefix="" \
50                 --program-suffix="" \
51                 --prefix=/usr \
52                 --exec-prefix=/usr \
53                 --bindir=/usr/bin \
54                 --sbindir=/usr/sbin \
55                 --libexecdir=/usr/lib \
56                 --sysconfdir=/etc \
57                 --datadir=/usr/share \
58                 --localstatedir=/var \
59                 --mandir=/usr/man \
60                 --infodir=/usr/info \
61                 $(DISABLE_NLS)
62
63 CONFIGURE_VARS = \
64                 $(TARGET_CONFIGURE_OPTS) \
65                 CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
66                 CXXFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
67                 CPPFLAGS="$(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" \
68                 LDFLAGS="$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)" \
69                 PKG_CONFIG_PATH="$(STAGING_DIR)/usr/lib/pkgconfig" \
70                 PKG_CONFIG_LIBDIR="$(STAGING_DIR)/usr/lib/pkgconfig"
71
72 CONFIGURE_PATH = .
73 CONFIGURE_CMD = ./configure
74
75 define Build/Configure/Default
76         (cd $(PKG_BUILD_DIR)/$(CONFIGURE_PATH)/$(strip $(3)); \
77         if [ -x $(CONFIGURE_CMD) ]; then \
78                 $(CP) $(SCRIPT_DIR)/config.{guess,sub} $(PKG_BUILD_DIR)/$(3)/ && \
79                 $(CONFIGURE_VARS) \
80                 $(2) \
81                 $(CONFIGURE_CMD) \
82                 $(CONFIGURE_ARGS) \
83                 $(1); \
84         fi; \
85         )
86 endef
87
88 MAKE_VARS = \
89         CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" \
90         CXXFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" \
91         LDFLAGS="$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)"
92
93 MAKE_FLAGS = \
94         $(TARGET_CONFIGURE_OPTS) \
95         CROSS="$(TARGET_CROSS)" \
96         ARCH="$(ARCH)"
97
98 MAKE_PATH = .
99
100 define Build/Compile/Default
101         $(MAKE_VARS) \
102         $(MAKE) -C $(PKG_BUILD_DIR)/$(MAKE_PATH) \
103                 $(MAKE_FLAGS) \
104                 $(1);
105 endef