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
35 package-rebuild
: FORCE
36 @
-rm $(PKG_BUILD_DIR
)/.built
38 define Build
/DefaultTargets
42 define Package
/Default
45 CATEGORY
:=Extra packages
47 MAINTAINER
:=OpenWrt Developers Team
<openwrt-devel@openwrt.org
>
48 SOURCE
:=$(patsubst $(TOPDIR
)/%,%,${shell pwd
})
49 VERSION
:=$(PKG_VERSION
)-$(PKG_RELEASE
)
59 $(eval
$(call Package
/Default
))
60 $(eval
$(call Package
/$(1)))
62 $(foreach FIELD
, TITLE CATEGORY PRIORITY VERSION
,
64 $$(error Package
/$(1) is missing the
$(FIELD
) field
)
72 ifeq ($(DESCRIPTION
),)
73 $(eval DESCRIPTION
:=$(TITLE
))
76 IPKG_
$(1):=$(PACKAGE_DIR
)/$(1)_
$(VERSION
)_
$(PKGARCH
).ipk
77 IDIR_
$(1):=$(PKG_BUILD_DIR
)/ipkg
/$(1)
78 INFO_
$(1):=$(IPKG_STATE_DIR
)/info/$(1).list
80 ifeq ($(CONFIG_PACKAGE_
$(1)),y
)
81 install-targets
: $$(INFO_
$(1))
84 ifneq ($(CONFIG_PACKAGE_
$(1))$(DEVELOPER
),)
85 compile-targets
: $$(IPKG_
$(1))
88 IDEPEND_
$(1):=$$(strip $$(DEPENDS
))
100 echo
"Default: $(DEFAULT)";
104 echo
"Version: $(VERSION)"; \
105 echo
"Depends: $$(IDEPEND_$(1))"; \
106 echo
"Category: $(CATEGORY)"; \
107 echo
"Title: $(TITLE)"; \
108 echo
"Description: $(DESCRIPTION)" | sed
-e
's,\\,\n,g';
121 echo
"Config: $(CONFIG)" | sed
-e
's,\\,\n,g'; \
125 $$(IDIR_
$(1))/CONTROL
/control
: $(PKG_BUILD_DIR
)/.prepared
126 mkdir
-p
$$(IDIR_
$(1))/CONTROL
127 echo
"Package: $(1)" > $$(IDIR_
$(1))/CONTROL
/control
128 echo
"Version: $(VERSION)" >> $$(IDIR_
$(1))/CONTROL
/control
129 echo
"Depends: $$(IDEPEND_$(1))" >> $$(IDIR_
$(1))/CONTROL
/control
130 echo
"Source: $(SOURCE)" >> $$(IDIR_
$(1))/CONTROL
/control
131 echo
"Section: $(SECTION)" >> $$(IDIR_
$(1))/CONTROL
/control
132 echo
"Priority: $(PRIORITY)" >> $$(IDIR_
$(1))/CONTROL
/control
133 echo
"Maintainer: $(MAINTAINER)" >> $$(IDIR_
$(1))/CONTROL
/control
134 echo
"Architecture: $(PKGARCH)" >> $$(IDIR_
$(1))/CONTROL
/control
135 echo
"Description: $(DESCRIPTION)" | sed
-e
's,\\,\n ,g' >> $$(IDIR_
$(1))/CONTROL
/control
136 chmod
644 $$(IDIR_
$(1))/CONTROL
/control
137 for file in conffiles preinst postinst prerm postrm
; do \
138 [ -f .
/ipkg
/$(1).
$$$$file ] && cp .
/ipkg
/$(1).
$$$$file $$(IDIR_
$(1))/CONTROL
/$$$$file || true
; \
141 $$(IPKG_
$(1)): $$(IDIR_
$(1))/CONTROL
/control
$(PKG_BUILD_DIR
)/.built
142 $(call Package
/$(1)/install,$$(IDIR_
$(1)))
143 mkdir
-p
$(PACKAGE_DIR
)
144 $(RSTRIP
) $$(IDIR_
$(1))
145 $(IPKG_BUILD
) $$(IDIR_
$(1)) $(PACKAGE_DIR
)
147 $$(INFO_
$(1)): $$(IPKG_
$(1))
148 $(IPKG
) install $$(IPKG_
$(1))
151 rm -f
$(PACKAGE_DIR
)/$(1)_
*
155 $$(eval
$$(call Build
/DefaultTargets
,$(1)))
159 ifneq ($(strip $(PKG_SOURCE
)),)
160 $(DL_DIR
)/$(PKG_SOURCE
):
161 $(SCRIPT_DIR
)/download.pl
"$(DL_DIR)" "$(PKG_SOURCE)" "$(PKG_MD5SUM)" $(PKG_SOURCE_URL
)
164 ifneq ($(strip $(PKG_CAT
)),)
165 define Build
/Prepare
/Default
166 @if
[ "$(PKG_CAT)" = "unzip" ]; then \
167 unzip
-d
$(PKG_BUILD_DIR
) $(DL_DIR
)/$(PKG_SOURCE
) ; \
169 $(PKG_CAT
) $(DL_DIR
)/$(PKG_SOURCE
) |
tar -C
$(PKG_BUILD_DIR
)/..
$(TAR_OPTIONS
) - ; \
171 @if
[ -d .
/patches
]; then \
172 $(PATCH
) $(PKG_BUILD_DIR
) .
/patches
; \
178 $(call Build
/Prepare
/Default
)
181 define Build
/Configure
/Default
182 @
(cd
$(PKG_BUILD_DIR
); \
183 [ -x configure
] && \
184 $(TARGET_CONFIGURE_OPTS
) \
185 CFLAGS
="$(TARGET_CFLAGS)" \
187 --target
=$(GNU_TARGET_NAME
) \
188 --host
=$(GNU_TARGET_NAME
) \
189 --build
=$(GNU_HOST_NAME
) \
193 --sbindir
=/usr
/sbin \
194 --libexecdir
=/usr
/lib \
196 --datadir=/usr
/share \
197 --localstatedir
=/var \
199 --infodir=/usr
/info \
206 define Build
/Configure
207 $(call Build
/Configure
/Default
,)
210 define Build
/Compile
/Default
211 $(MAKE
) -C
$(PKG_BUILD_DIR
) \
213 CROSS
="$(TARGET_CROSS)" \
214 PREFIX
="$$(IDIR_$(1))" \
215 EXTRA_CFLAGS
="$(TARGET_CFLAGS)" \
217 DESTDIR
="$$(IDIR_$(1))" \
222 $(call Build
/Compile
/Default
,)
237 source
: $(DL_DIR
)/$(PKG_SOURCE
)
238 prepare
: $(PKG_BUILD_DIR
)/.prepared
239 configure
: $(PKG_BUILD_DIR
)/.configured
242 compile
: compile-targets
245 install: install-targets
249 @
$(MAKE
) clean-targets
250 rm -rf
$(PKG_BUILD_DIR
)