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 ifeq ($$(shell $(SCRIPT_DIR
)/timestamp.pl
-p
-x ipkg
$$(IPKG_
$(1)) $(PKG_BUILD_DIR
)),$(PKG_BUILD_DIR
))
28 rm -f
$(PKG_BUILD_DIR
)/.built
30 define Build
/DefaultTargets
34 define Package
/Default
37 CATEGORY
:=Extra packages
39 MAINTAINER
:=OpenWrt Developers Team
<openwrt-devel@openwrt.org
>
40 SOURCE
:=$(patsubst $(TOPDIR
)/%,%,${shell pwd
})
41 VERSION
:=$(PKG_VERSION
)-$(PKG_RELEASE
)
52 $$(error Package
/$$(1) is missing the
$(1) field
)
57 $(eval
$(call Package
/Default
))
58 $(eval
$(call Package
/$(1)))
60 $(foreach FIELD
, TITLE CATEGORY PRIORITY VERSION
, $(eval
$(call RequiredField
,$(FIELD
))))
66 ifeq ($(DESCRIPTION
),)
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 compile-targets
: $$(IPKG_
$(1))
86 IDEPEND_
$(1):=$$(strip $$(DEPENDS
))
96 echo
"Default: $(DEFAULT)";
99 echo
"Version: $(VERSION)"; \
100 echo
"Depends: $$(IDEPEND_$(1))"; \
101 echo
"Category: $(CATEGORY)"; \
102 echo
"Title: $(TITLE)"; \
103 echo
"Description: $(DESCRIPTION)" | sed
-e
's,\\,\n,g';
113 $$(IDIR_
$(1))/CONTROL
/control
: $(PKG_BUILD_DIR
)/.prepared
114 mkdir
-p
$$(IDIR_
$(1))/CONTROL
115 echo
"Package: $(1)" > $$(IDIR_
$(1))/CONTROL
/control
116 echo
"Version: $(VERSION)" >> $$(IDIR_
$(1))/CONTROL
/control
117 echo
"Depends: $$(IDEPEND_$(1))" >> $$(IDIR_
$(1))/CONTROL
/control
118 echo
"Source: $(SOURCE)" >> $$(IDIR_
$(1))/CONTROL
/control
119 echo
"Section: $(SECTION)" >> $$(IDIR_
$(1))/CONTROL
/control
120 echo
"Priority: $(PRIORITY)" >> $$(IDIR_
$(1))/CONTROL
/control
121 echo
"Maintainer: $(MAINTAINER)" >> $$(IDIR_
$(1))/CONTROL
/control
122 echo
"Architecture: $(PKGARCH)" >> $$(IDIR_
$(1))/CONTROL
/control
123 echo
"Description: $(DESCRIPTION)" | sed
-e
's,\\,\n ,g' >> $$(IDIR_
$(1))/CONTROL
/control
124 chmod
644 $$(IDIR_
$(1))/CONTROL
/control
125 for file in conffiles preinst postinst prerm postrm
; do \
126 [ -f .
/ipkg
/$(1).
$$$$file ] && cp .
/ipkg
/$(1).
$$$$file $$(IDIR_
$(1))/CONTROL
/$$$$file || true
; \
129 $$(IPKG_
$(1)): $$(IDIR_
$(1))/CONTROL
/control
$(PKG_BUILD_DIR
)/.built
130 $(call Package
/$(1)/install,$$(IDIR_
$(1)))
131 mkdir
-p
$(PACKAGE_DIR
)
132 $(RSTRIP
) $$(IDIR_
$(1))
133 $(IPKG_BUILD
) $$(IDIR_
$(1)) $(PACKAGE_DIR
)
135 $$(INFO_
$(1)): $$(IPKG_
$(1))
136 $(IPKG
) install $$(IPKG_
$(1))
139 rm -f
$(PACKAGE_DIR
)/$(1)_
*
142 ifneq ($(__DEFAULT_TARGETS
),1)
143 $(eval
$(call Build
/DefaultTargets
))
148 ifneq ($(strip $(PKG_SOURCE
)),)
149 $(DL_DIR
)/$(PKG_SOURCE
):
150 $(SCRIPT_DIR
)/download.pl
"$(DL_DIR)" "$(PKG_SOURCE)" "$(PKG_MD5SUM)" $(PKG_SOURCE_URL
)
153 ifneq ($(strip $(PKG_CAT
)),)
154 define Build
/Prepare
/Default
155 @if
[ "$(PKG_CAT)" = "unzip" ]; then \
156 unzip
-d
$(PKG_BUILD_DIR
) $(DL_DIR
)/$(PKG_SOURCE
) ; \
158 $(PKG_CAT
) $(DL_DIR
)/$(PKG_SOURCE
) |
tar -C
$(PKG_BUILD_DIR
)/..
$(TAR_OPTIONS
) - ; \
160 @if
[ -d .
/patches
]; then \
161 $(PATCH
) $(PKG_BUILD_DIR
) .
/patches
; \
167 $(call Build
/Prepare
/Default
)
170 define Build
/Configure
/Default
171 @
(cd
$(PKG_BUILD_DIR
); \
172 [ -x configure
] && \
173 $(TARGET_CONFIGURE_OPTS
) \
174 CFLAGS
="$(TARGET_CFLAGS)" \
176 --target
=$(GNU_TARGET_NAME
) \
177 --host
=$(GNU_TARGET_NAME
) \
178 --build
=$(GNU_HOST_NAME
) \
182 --sbindir
=/usr
/sbin \
183 --libexecdir
=/usr
/lib \
185 --datadir=/usr
/share \
186 --localstatedir
=/var \
188 --infodir=/usr
/info \
194 define Build
/Configure
195 $(call Build
/Configure
/Default
,)
198 define Build
/Compile
/Default
199 $(MAKE
) -C
$(PKG_BUILD_DIR
) \
201 CROSS
="$(TARGET_CROSS)" \
202 PREFIX
="$$(IDIR_$(1))" \
203 EXTRA_CFLAGS
="$(TARGET_CFLAGS)" \
205 DESTDIR
="$$(IDIR_$(1))"
209 $(call Build
/Compile
/Default
)
224 source
: FORCE
$(DL_DIR
)/$(PKG_SOURCE
)
225 prepare
: FORCE
$(PKG_BUILD_DIR
)/.prepared
226 configure
: FORCE
$(PKG_BUILD_DIR
)/.configured
228 compile-targets
: FORCE
229 compile
: FORCE compile-targets
231 install-targets
: FORCE
232 install: FORCE install-targets
236 @
$(MAKE
) clean-targets
237 rm -rf
$(PKG_BUILD_DIR
)