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';
119 $$(IDIR_
$(1))/CONTROL
/control
: $(PKG_BUILD_DIR
)/.prepared
120 mkdir
-p
$$(IDIR_
$(1))/CONTROL
121 echo
"Package: $(1)" > $$(IDIR_
$(1))/CONTROL
/control
122 echo
"Version: $(VERSION)" >> $$(IDIR_
$(1))/CONTROL
/control
123 echo
"Depends: $$(IDEPEND_$(1))" >> $$(IDIR_
$(1))/CONTROL
/control
124 echo
"Source: $(SOURCE)" >> $$(IDIR_
$(1))/CONTROL
/control
125 echo
"Section: $(SECTION)" >> $$(IDIR_
$(1))/CONTROL
/control
126 echo
"Priority: $(PRIORITY)" >> $$(IDIR_
$(1))/CONTROL
/control
127 echo
"Maintainer: $(MAINTAINER)" >> $$(IDIR_
$(1))/CONTROL
/control
128 echo
"Architecture: $(PKGARCH)" >> $$(IDIR_
$(1))/CONTROL
/control
129 echo
"Description: $(DESCRIPTION)" | sed
-e
's,\\,\n ,g' >> $$(IDIR_
$(1))/CONTROL
/control
130 chmod
644 $$(IDIR_
$(1))/CONTROL
/control
131 for file in conffiles preinst postinst prerm postrm
; do \
132 [ -f .
/ipkg
/$(1).
$$$$file ] && cp .
/ipkg
/$(1).
$$$$file $$(IDIR_
$(1))/CONTROL
/$$$$file || true
; \
135 $$(IPKG_
$(1)): $$(IDIR_
$(1))/CONTROL
/control
$(PKG_BUILD_DIR
)/.built
136 $(call Package
/$(1)/install,$$(IDIR_
$(1)))
137 mkdir
-p
$(PACKAGE_DIR
)
138 $(RSTRIP
) $$(IDIR_
$(1))
139 $(IPKG_BUILD
) $$(IDIR_
$(1)) $(PACKAGE_DIR
)
141 $$(INFO_
$(1)): $$(IPKG_
$(1))
142 $(IPKG
) install $$(IPKG_
$(1))
145 rm -f
$(PACKAGE_DIR
)/$(1)_
*
149 $$(eval
$$(call Build
/DefaultTargets
,$(1)))
153 ifneq ($(strip $(PKG_SOURCE
)),)
154 $(DL_DIR
)/$(PKG_SOURCE
):
155 $(SCRIPT_DIR
)/download.pl
"$(DL_DIR)" "$(PKG_SOURCE)" "$(PKG_MD5SUM)" $(PKG_SOURCE_URL
)
158 ifneq ($(strip $(PKG_CAT
)),)
159 define Build
/Prepare
/Default
160 @if
[ "$(PKG_CAT)" = "unzip" ]; then \
161 unzip
-d
$(PKG_BUILD_DIR
) $(DL_DIR
)/$(PKG_SOURCE
) ; \
163 $(PKG_CAT
) $(DL_DIR
)/$(PKG_SOURCE
) |
tar -C
$(PKG_BUILD_DIR
)/..
$(TAR_OPTIONS
) - ; \
165 @if
[ -d .
/patches
]; then \
166 $(PATCH
) $(PKG_BUILD_DIR
) .
/patches
; \
172 $(call Build
/Prepare
/Default
)
175 define Build
/Configure
/Default
176 @
(cd
$(PKG_BUILD_DIR
); \
177 [ -x configure
] && \
178 $(TARGET_CONFIGURE_OPTS
) \
179 CFLAGS
="$(TARGET_CFLAGS)" \
181 --target
=$(GNU_TARGET_NAME
) \
182 --host
=$(GNU_TARGET_NAME
) \
183 --build
=$(GNU_HOST_NAME
) \
187 --sbindir
=/usr
/sbin \
188 --libexecdir
=/usr
/lib \
190 --datadir=/usr
/share \
191 --localstatedir
=/var \
193 --infodir=/usr
/info \
200 define Build
/Configure
201 $(call Build
/Configure
/Default
,)
204 define Build
/Compile
/Default
205 $(MAKE
) -C
$(PKG_BUILD_DIR
) \
207 CROSS
="$(TARGET_CROSS)" \
208 PREFIX
="$$(IDIR_$(1))" \
209 EXTRA_CFLAGS
="$(TARGET_CFLAGS)" \
211 DESTDIR
="$$(IDIR_$(1))" \
216 $(call Build
/Compile
/Default
,)
231 source
: $(DL_DIR
)/$(PKG_SOURCE
)
232 prepare
: $(PKG_BUILD_DIR
)/.prepared
233 configure
: $(PKG_BUILD_DIR
)/.configured
236 compile
: compile-targets
239 install: install-targets
243 @
$(MAKE
) clean-targets
244 rm -rf
$(PKG_BUILD_DIR
)