7 define Build/DefaultTargets
8 $(PKG_BUILD_DIR)/.prepared: FORCE $(DL_DIR)/$(PKG_SOURCE)
9 ifeq ($(shell $(SCRIPT_DIR)/timestamp.pl -p $(PKG_BUILD_DIR) .),.)
10 @-rm -rf $(PKG_BUILD_DIR)
11 @mkdir -p $(PKG_BUILD_DIR)
16 $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared
17 $(call Build/Configure)
20 $(PKG_BUILD_DIR)/.built: FORCE $(PKG_BUILD_DIR)/.configured
21 #$#$#(error $$(shell $(SCRIPT_DIR)/timestamp.pl -p -x ipkg $$(IPKG_$(1)) $(PKG_BUILD_DIR)))
22 ifeq ($$(shell $(SCRIPT_DIR)/timestamp.pl -p -x ipkg $$(IPKG_$(1)) $(PKG_BUILD_DIR)),$(PKG_BUILD_DIR))
29 rm -f $(PKG_BUILD_DIR)/.built
31 define Build/DefaultTargets
35 define Package/Default
38 CATEGORY:=Extra packages
40 MAINTAINER:=OpenWrt Developers Team <openwrt-devel@openwrt.org>
41 SOURCE:=$(patsubst $(TOPDIR)/%,%,${shell pwd})
42 VERSION:=$(PKG_VERSION)-$(PKG_RELEASE)
53 $$(error Package/$$(1) is missing the $(1) field)
58 $(eval $(call Package/Default))
59 $(eval $(call Package/$(1)))
61 $(foreach FIELD, TITLE CATEGORY PRIORITY VERSION, $(eval $(call RequiredField,$(FIELD))))
67 ifeq ($(DESCRIPTION),)
68 $(eval DESCRIPTION:=$(TITLE))
71 IPKG_$(1):=$(PACKAGE_DIR)/$(1)_$(VERSION)_$(PKGARCH).ipk
72 IDIR_$(1):=$(PKG_BUILD_DIR)/ipkg/$(1)
73 INFO_$(1):=$(IPKG_STATE_DIR)/info/$(1).list
75 ifneq ($(CONFIG_PACKAGE_$(1))$(DEVELOPER),)
79 ifeq ($(CONFIG_PACKAGE_$(1)),y)
80 install-targets: $$(INFO_$(1))
83 ifneq ($(COMPILE_$(1)),)
84 compile-targets: $(IPKG_$(1))
87 IDEPEND_$(1):=$$(strip $$(DEPENDS))
97 echo "Default: $(DEFAULT)";
100 echo "Version: $(VERSION)"; \
101 echo "Depends: $$(IDEPEND_$(1))"; \
102 echo "Category: $(CATEGORY)"; \
103 echo "Title: $(TITLE)"; \
104 echo "Description: $(DESCRIPTION)" | sed -e 's,\\,\n,g';
114 $$(IDIR_$(1))/CONTROL/control: $(PKG_BUILD_DIR)/.prepared
115 mkdir -p $$(IDIR_$(1))/CONTROL
116 echo "Package: $(1)" > $$(IDIR_$(1))/CONTROL/control
117 echo "Version: $(VERSION)" >> $$(IDIR_$(1))/CONTROL/control
118 echo "Depends: $$(IDEPEND_$(1))" >> $$(IDIR_$(1))/CONTROL/control
119 echo "Source: $(SOURCE)" >> $$(IDIR_$(1))/CONTROL/control
120 echo "Section: $(SECTION)" >> $$(IDIR_$(1))/CONTROL/control
121 echo "Priority: $(PRIORITY)" >> $$(IDIR_$(1))/CONTROL/control
122 echo "Maintainer: $(MAINTAINER)" >> $$(IDIR_$(1))/CONTROL/control
123 echo "Architecture: $(PKGARCH)" >> $$(IDIR_$(1))/CONTROL/control
124 echo "Description: $(DESCRIPTION)" | sed -e 's,\\,\n ,g' >> $$(IDIR_$(1))/CONTROL/control
125 chmod 644 $$(IDIR_$(1))/CONTROL/control
126 for file in conffiles preinst postinst prerm postrm; do \
127 [ -f ./ipkg/$(1).$$$$file ] && cp ./ipkg/$(1).$$$$file $$(IDIR_$(1))/CONTROL/$$$$file || true; \
130 $$(IPKG_$(1)): $$(IDIR_$(1))/CONTROL/control $(PKG_BUILD_DIR)/.built
131 $(call Package/$(1)/install,$$(IDIR_$(1)))
132 mkdir -p $(PACKAGE_DIR)
133 $(RSTRIP) $$(IDIR_$(1))
134 $(IPKG_BUILD) $$(IDIR_$(1)) $(PACKAGE_DIR)
136 $$(INFO_$(1)): $$(IPKG_$(1))
137 $(IPKG) install $$(IPKG_$(1))
140 rm -f $(PACKAGE_DIR)/$(1)_*
143 ifneq ($(__DEFAULT_TARGETS),1)
144 $$(eval $$(call Build/DefaultTargets,$(1)))
149 ifneq ($(strip $(PKG_SOURCE)),)
150 $(DL_DIR)/$(PKG_SOURCE):
151 $(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(PKG_SOURCE)" "$(PKG_MD5SUM)" $(PKG_SOURCE_URL)
154 ifneq ($(strip $(PKG_CAT)),)
155 define Build/Prepare/Default
156 @if [ "$(PKG_CAT)" = "unzip" ]; then \
157 unzip -d $(PKG_BUILD_DIR) $(DL_DIR)/$(PKG_SOURCE) ; \
159 $(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | tar -C $(PKG_BUILD_DIR)/.. $(TAR_OPTIONS) - ; \
161 @if [ -d ./patches ]; then \
162 $(PATCH) $(PKG_BUILD_DIR) ./patches ; \
168 $(call Build/Prepare/Default)
171 define Build/Configure/Default
172 @(cd $(PKG_BUILD_DIR); \
173 [ -x configure ] && \
174 $(TARGET_CONFIGURE_OPTS) \
175 CFLAGS="$(TARGET_CFLAGS)" \
177 --target=$(GNU_TARGET_NAME) \
178 --host=$(GNU_TARGET_NAME) \
179 --build=$(GNU_HOST_NAME) \
183 --sbindir=/usr/sbin \
184 --libexecdir=/usr/lib \
186 --datadir=/usr/share \
187 --localstatedir=/var \
189 --infodir=/usr/info \
195 define Build/Configure
196 $(call Build/Configure/Default,)
199 define Build/Compile/Default
200 $(MAKE) -C $(PKG_BUILD_DIR) \
202 CROSS="$(TARGET_CROSS)" \
203 PREFIX="$$(IDIR_$(1))" \
204 EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
206 DESTDIR="$$(IDIR_$(1))"
210 $(call Build/Compile/Default)
225 source: FORCE $(DL_DIR)/$(PKG_SOURCE)
226 prepare: FORCE $(PKG_BUILD_DIR)/.prepared
227 configure: FORCE $(PKG_BUILD_DIR)/.configured
229 compile-targets: FORCE
230 compile: FORCE compile-targets
232 install-targets: FORCE
233 install: FORCE install-targets
237 @$(MAKE) clean-targets
238 rm -rf $(PKG_BUILD_DIR)