7 define Build
/DefaultTargets
9 ifeq ($$(shell $(SCRIPT_DIR
)/timestamp.pl
-p
$(PKG_BUILD_DIR
) . | tee
/tmp
/xy1
),.
)
10 $(PKG_BUILD_DIR
)/.prepared
: package-clean
13 ifneq ($$(shell $(SCRIPT_DIR
)/timestamp.pl
-p
-x ipkg
$(IPKG_
$(1)) $(PKG_BUILD_DIR
) | tee
/tmp
/xy2
),$(IPKG_
$(1)))
14 $(PKG_BUILD_DIR
)/.built
: package-rebuild
18 $(PKG_BUILD_DIR
)/.prepared
: $(DL_DIR
)/$(PKG_SOURCE
)
19 @
-rm -rf
$(PKG_BUILD_DIR
)
20 @mkdir
-p
$(PKG_BUILD_DIR
)
24 $(PKG_BUILD_DIR
)/.configured
: $(PKG_BUILD_DIR
)/.prepared
25 $(call Build
/Configure
)
28 $(PKG_BUILD_DIR
)/.built
: $(PKG_BUILD_DIR
)/.configured
32 $(PKG_BUILD_DIR
)/.dev-installed
: $(PKG_BUILD_DIR
)/.built
33 $(call Build
/InstallDev
)
38 $(call Build
/UninstallDev
)
40 package-rebuild
: FORCE
41 @
-rm $(PKG_BUILD_DIR
)/.built
43 define Build
/DefaultTargets
47 define Package
/Default
50 CATEGORY
:=Extra packages
52 MAINTAINER
:=OpenWrt Developers Team
<openwrt-devel@openwrt.org
>
53 SOURCE
:=$(patsubst $(TOPDIR
)/%,%,${shell pwd
})
54 VERSION
:=$(PKG_VERSION
)-$(PKG_RELEASE
)
64 $(eval
$(call Package
/Default
))
65 $(eval
$(call Package
/$(1)))
67 $(foreach FIELD
, TITLE CATEGORY PRIORITY VERSION
,
69 $$(error Package
/$(1) is missing the
$(FIELD
) field
)
77 ifeq ($(DESCRIPTION
),)
78 $(eval DESCRIPTION
:=$(TITLE
))
81 IPKG_
$(1):=$(PACKAGE_DIR
)/$(1)_
$(VERSION
)_
$(PKGARCH
).ipk
82 IDIR_
$(1):=$(PKG_BUILD_DIR
)/ipkg
/$(1)
83 INFO_
$(1):=$(IPKG_STATE_DIR
)/info/$(1).list
85 ifeq ($(CONFIG_PACKAGE_
$(1)),y
)
86 install-targets
: $$(INFO_
$(1))
89 ifneq ($(CONFIG_PACKAGE_
$(1))$(DEVELOPER
),)
90 compile-targets
: $$(IPKG_
$(1))
93 IDEPEND_
$(1):=$$(strip $$(DEPENDS
))
100 echo
"Menu: $(MENU)";
105 echo
"Default: $(DEFAULT)";
109 echo
"Version: $(VERSION)"; \
110 echo
"Depends: $$(IDEPEND_$(1))"; \
111 echo
"Build-Depends: $(PKG_BUILDDEP)"; \
112 echo
"Category: $(CATEGORY)"; \
113 echo
"Title: $(TITLE)"; \
114 echo
"Description: $(DESCRIPTION)" | sed
-e
's,\\,\n,g';
127 echo
"Config: $(CONFIG)" | sed
-e
's,\\,\n,g'; \
131 $$(IDIR_
$(1))/CONTROL
/control
: $(PKG_BUILD_DIR
)/.prepared
132 mkdir
-p
$$(IDIR_
$(1))/CONTROL
133 echo
"Package: $(1)" > $$(IDIR_
$(1))/CONTROL
/control
134 echo
"Version: $(VERSION)" >> $$(IDIR_
$(1))/CONTROL
/control
137 for depend in
$$(IDEPEND_
$(1)); do \
138 [ "$$$${depend%%%%%%%%[A-Za-z]*}" = "@" ] && continue
; \
139 DEPENDS
=$$$${DEPENDS
:+$$$$DEPENDS, }$$$${depend
##+}; \
141 echo
"Depends: $$$$DEPENDS" >> $$(IDIR_
$(1))/CONTROL
/control
; \
143 echo
"Source: $(SOURCE)" >> $$(IDIR_
$(1))/CONTROL
/control
144 echo
"Section: $(SECTION)" >> $$(IDIR_
$(1))/CONTROL
/control
145 echo
"Priority: $(PRIORITY)" >> $$(IDIR_
$(1))/CONTROL
/control
146 echo
"Maintainer: $(MAINTAINER)" >> $$(IDIR_
$(1))/CONTROL
/control
147 echo
"Architecture: $(PKGARCH)" >> $$(IDIR_
$(1))/CONTROL
/control
148 echo
"Description: $(DESCRIPTION)" | sed
-e
's,\\,\n ,g' >> $$(IDIR_
$(1))/CONTROL
/control
149 chmod
644 $$(IDIR_
$(1))/CONTROL
/control
150 for file in conffiles preinst postinst prerm postrm
; do \
151 [ -f .
/ipkg
/$(1).
$$$$file ] && cp .
/ipkg
/$(1).
$$$$file $$(IDIR_
$(1))/CONTROL
/$$$$file || true
; \
154 $$(IPKG_
$(1)): $$(IDIR_
$(1))/CONTROL
/control
$(PKG_BUILD_DIR
)/.built
155 $(call Package
/$(1)/install,$$(IDIR_
$(1)))
156 mkdir
-p
$(PACKAGE_DIR
)
157 find
$$(IDIR_
$(1)) -name CVS | xargs
rm -rf
158 find
$$(IDIR_
$(1)) -name .svn | xargs
rm -rf
159 $(RSTRIP
) $$(IDIR_
$(1))
160 $(IPKG_BUILD
) $$(IDIR_
$(1)) $(PACKAGE_DIR
)
162 $$(INFO_
$(1)): $$(IPKG_
$(1))
163 $(IPKG
) install $$(IPKG_
$(1))
166 rm -f
$(PACKAGE_DIR
)/$(1)_
*
170 $$(eval
$$(call Build
/DefaultTargets
,$(1)))
174 ifneq ($(strip $(PKG_SOURCE
)),)
175 $(DL_DIR
)/$(PKG_SOURCE
):
176 $(SCRIPT_DIR
)/download.pl
"$(DL_DIR)" "$(PKG_SOURCE)" "$(PKG_MD5SUM)" $(PKG_SOURCE_URL
)
179 ifneq ($(strip $(PKG_CAT
)),)
180 define Build
/Prepare
/Default
181 @if
[ "$(PKG_CAT)" = "unzip" ]; then \
182 unzip
-d
$(PKG_BUILD_DIR
) $(DL_DIR
)/$(PKG_SOURCE
) ; \
184 $(PKG_CAT
) $(DL_DIR
)/$(PKG_SOURCE
) |
tar -C
$(PKG_BUILD_DIR
)/..
$(TAR_OPTIONS
) - ; \
186 @if
[ -d .
/patches
]; then \
187 $(PATCH
) $(PKG_BUILD_DIR
) .
/patches
; \
193 $(call Build
/Prepare
/Default
)
196 define Build
/Configure
/Default
197 @
(cd
$(PKG_BUILD_DIR
); \
198 [ -x configure
] && \
199 $(TARGET_CONFIGURE_OPTS
) \
200 CFLAGS
="$(TARGET_CFLAGS)" \
201 CPPFLAGS
="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
202 LDFLAGS
="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \
204 --target
=$(GNU_TARGET_NAME
) \
205 --host
=$(GNU_TARGET_NAME
) \
206 --build
=$(GNU_HOST_NAME
) \
207 --program-prefix
="" \
208 --program-suffix
="" \
212 --sbindir
=/usr
/sbin \
213 --libexecdir
=/usr
/lib \
215 --datadir=/usr
/share \
216 --localstatedir
=/var \
218 --infodir=/usr
/info \
225 define Build
/Configure
226 $(call Build
/Configure
/Default
,)
229 define Build
/Compile
/Default
230 $(MAKE
) -C
$(PKG_BUILD_DIR
) \
232 CROSS
="$(TARGET_CROSS)" \
233 PREFIX
="$$(IDIR_$(1))" \
234 EXTRA_CFLAGS
="$(TARGET_CFLAGS)" \
236 DESTDIR
="$$(IDIR_$(1))" \
241 $(call Build
/Compile
/Default
,)
244 define Build
/InstallDev
251 define Build
/UninstallDev
262 source
: $(DL_DIR
)/$(PKG_SOURCE
)
263 prepare
: $(PKG_BUILD_DIR
)/.prepared
264 configure
: $(PKG_BUILD_DIR
)/.configured
266 compile-targets
: $(PKG_BUILD_DIR
)/.dev-installed
267 compile
: compile-targets
270 install: install-targets
274 @
$(MAKE
) clean-targets
275 rm -rf
$(PKG_BUILD_DIR
)