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 $(RSTRIP
) $$(IDIR_
$(1))
158 $(IPKG_BUILD
) $$(IDIR_
$(1)) $(PACKAGE_DIR
)
160 $$(INFO_
$(1)): $$(IPKG_
$(1))
161 $(IPKG
) install $$(IPKG_
$(1))
164 rm -f
$(PACKAGE_DIR
)/$(1)_
*
168 $$(eval
$$(call Build
/DefaultTargets
,$(1)))
172 ifneq ($(strip $(PKG_SOURCE
)),)
173 $(DL_DIR
)/$(PKG_SOURCE
):
174 $(SCRIPT_DIR
)/download.pl
"$(DL_DIR)" "$(PKG_SOURCE)" "$(PKG_MD5SUM)" $(PKG_SOURCE_URL
)
177 ifneq ($(strip $(PKG_CAT
)),)
178 define Build
/Prepare
/Default
179 @if
[ "$(PKG_CAT)" = "unzip" ]; then \
180 unzip
-d
$(PKG_BUILD_DIR
) $(DL_DIR
)/$(PKG_SOURCE
) ; \
182 $(PKG_CAT
) $(DL_DIR
)/$(PKG_SOURCE
) |
tar -C
$(PKG_BUILD_DIR
)/..
$(TAR_OPTIONS
) - ; \
184 @if
[ -d .
/patches
]; then \
185 $(PATCH
) $(PKG_BUILD_DIR
) .
/patches
; \
191 $(call Build
/Prepare
/Default
)
194 define Build
/Configure
/Default
195 @
(cd
$(PKG_BUILD_DIR
); \
196 [ -x configure
] && \
197 $(TARGET_CONFIGURE_OPTS
) \
198 CFLAGS
="$(TARGET_CFLAGS)" \
199 CPPFLAGS
="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
200 LDFLAGS
="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \
202 --target
=$(GNU_TARGET_NAME
) \
203 --host
=$(GNU_TARGET_NAME
) \
204 --build
=$(GNU_HOST_NAME
) \
205 --program-prefix
="" \
206 --program-suffix
="" \
210 --sbindir
=/usr
/sbin \
211 --libexecdir
=/usr
/lib \
213 --datadir=/usr
/share \
214 --localstatedir
=/var \
216 --infodir=/usr
/info \
223 define Build
/Configure
224 $(call Build
/Configure
/Default
,)
227 define Build
/Compile
/Default
228 $(MAKE
) -C
$(PKG_BUILD_DIR
) \
230 CROSS
="$(TARGET_CROSS)" \
231 PREFIX
="$$(IDIR_$(1))" \
232 EXTRA_CFLAGS
="$(TARGET_CFLAGS)" \
234 DESTDIR
="$$(IDIR_$(1))" \
239 $(call Build
/Compile
/Default
,)
242 define Build
/InstallDev
249 define Build
/UninstallDev
260 source
: $(DL_DIR
)/$(PKG_SOURCE
)
261 prepare
: $(PKG_BUILD_DIR
)/.prepared
262 configure
: $(PKG_BUILD_DIR
)/.configured
264 compile-targets
: $(PKG_BUILD_DIR
)/.dev-installed
265 compile
: compile-targets
268 install: install-targets
272 @
$(MAKE
) clean-targets
273 rm -rf
$(PKG_BUILD_DIR
)