7 define Build
/DefaultTargets
9 ifeq ($(shell $(SCRIPT_DIR
)/timestamp.pl
-p
$(PKG_BUILD_DIR
) .
),.
)
10 $(PKG_BUILD_DIR
)/.prepared
: package-clean
13 $(PKG_BUILD_DIR
)/.prepared
: $(DL_DIR
)/$(PKG_SOURCE
)
14 @
-rm -rf
$(PKG_BUILD_DIR
)
15 @mkdir
-p
$(PKG_BUILD_DIR
)
19 $(PKG_BUILD_DIR
)/.configured
: $(PKG_BUILD_DIR
)/.prepared
20 $(call Build
/Configure
)
23 built
: FORCE
$(PKG_BUILD_DIR
)/.configured
24 ifneq ($$(shell $(SCRIPT_DIR
)/timestamp.pl
-p
-x ipkg
$(IPKG_
$(1)) $(PKG_BUILD_DIR
)),$(IPKG_
$(1)))
31 define Build
/DefaultTargets
35 define Package
/Default
38 CATEGORY
:=Extra packages
40 MAINTAINER
:=OpenWrt Developers Team
<openwrt-devel@openwrt.org
>
41 SOURCE
:=$(patsubst $(TOPDIR
)/%,%,${shell pwd
})
42 VERSION
:=$(PKG_VERSION
)-$(PKG_RELEASE
)
52 $(eval
$(call Package
/Default
))
53 $(eval
$(call Package
/$(1)))
55 $(foreach FIELD
, TITLE CATEGORY PRIORITY VERSION
,
57 $$(error Package
/$(1) is missing the
$(FIELD
) field
)
65 ifeq ($(DESCRIPTION
),)
66 $(eval DESCRIPTION
:=$(TITLE
))
69 IPKG_
$(1):=$(PACKAGE_DIR
)/$(1)_
$(VERSION
)_
$(PKGARCH
).ipk
70 IDIR_
$(1):=$(PKG_BUILD_DIR
)/ipkg
/$(1)
71 INFO_
$(1):=$(IPKG_STATE_DIR
)/info/$(1).list
73 ifneq ($(CONFIG_PACKAGE_
$(1))$(DEVELOPER
),)
77 ifeq ($(CONFIG_PACKAGE_
$(1)),y
)
78 install-targets
: $$(INFO_
$(1))
81 ifneq ($(COMPILE_
$(1)),)
82 compile-targets
: $(IPKG_
$(1))
85 IDEPEND_
$(1):=$$(strip $$(DEPENDS
))
97 echo
"Default: $(DEFAULT)";
101 echo
"Version: $(VERSION)"; \
102 echo
"Depends: $$(IDEPEND_$(1))"; \
103 echo
"Category: $(CATEGORY)"; \
104 echo
"Title: $(TITLE)"; \
105 echo
"Description: $(DESCRIPTION)" | sed
-e
's,\\,\n,g';
116 $$(IDIR_
$(1))/CONTROL
/control
: $(PKG_BUILD_DIR
)/.prepared
117 mkdir
-p
$$(IDIR_
$(1))/CONTROL
118 echo
"Package: $(1)" > $$(IDIR_
$(1))/CONTROL
/control
119 echo
"Version: $(VERSION)" >> $$(IDIR_
$(1))/CONTROL
/control
120 echo
"Depends: $$(IDEPEND_$(1))" >> $$(IDIR_
$(1))/CONTROL
/control
121 echo
"Source: $(SOURCE)" >> $$(IDIR_
$(1))/CONTROL
/control
122 echo
"Section: $(SECTION)" >> $$(IDIR_
$(1))/CONTROL
/control
123 echo
"Priority: $(PRIORITY)" >> $$(IDIR_
$(1))/CONTROL
/control
124 echo
"Maintainer: $(MAINTAINER)" >> $$(IDIR_
$(1))/CONTROL
/control
125 echo
"Architecture: $(PKGARCH)" >> $$(IDIR_
$(1))/CONTROL
/control
126 echo
"Description: $(DESCRIPTION)" | sed
-e
's,\\,\n ,g' >> $$(IDIR_
$(1))/CONTROL
/control
127 chmod
644 $$(IDIR_
$(1))/CONTROL
/control
128 for file in conffiles preinst postinst prerm postrm
; do \
129 [ -f .
/ipkg
/$(1).
$$$$file ] && cp .
/ipkg
/$(1).
$$$$file $$(IDIR_
$(1))/CONTROL
/$$$$file || true
; \
132 $$(IPKG_
$(1)): $$(IDIR_
$(1))/CONTROL
/control built
133 $(call Package
/$(1)/install,$$(IDIR_
$(1)))
134 mkdir
-p
$(PACKAGE_DIR
)
135 $(RSTRIP
) $$(IDIR_
$(1))
136 $(IPKG_BUILD
) $$(IDIR_
$(1)) $(PACKAGE_DIR
)
138 $$(INFO_
$(1)): $$(IPKG_
$(1))
139 $(IPKG
) install $$(IPKG_
$(1))
142 rm -f
$(PACKAGE_DIR
)/$(1)_
*
146 ifneq ($(__DEFAULT_TARGETS
),1)
147 $$(eval
$$(call Build
/DefaultTargets
,$(1)))
152 ifneq ($(strip $(PKG_SOURCE
)),)
153 $(DL_DIR
)/$(PKG_SOURCE
):
154 $(SCRIPT_DIR
)/download.pl
"$(DL_DIR)" "$(PKG_SOURCE)" "$(PKG_MD5SUM)" $(PKG_SOURCE_URL
)
157 ifneq ($(strip $(PKG_CAT
)),)
158 define Build
/Prepare
/Default
159 @if
[ "$(PKG_CAT)" = "unzip" ]; then \
160 unzip
-d
$(PKG_BUILD_DIR
) $(DL_DIR
)/$(PKG_SOURCE
) ; \
162 $(PKG_CAT
) $(DL_DIR
)/$(PKG_SOURCE
) |
tar -C
$(PKG_BUILD_DIR
)/..
$(TAR_OPTIONS
) - ; \
164 @if
[ -d .
/patches
]; then \
165 $(PATCH
) $(PKG_BUILD_DIR
) .
/patches
; \
171 $(call Build
/Prepare
/Default
)
174 define Build
/Configure
/Default
175 @
(cd
$(PKG_BUILD_DIR
); \
176 [ -x configure
] && \
177 $(TARGET_CONFIGURE_OPTS
) \
178 CFLAGS
="$(TARGET_CFLAGS)" \
180 --target
=$(GNU_TARGET_NAME
) \
181 --host
=$(GNU_TARGET_NAME
) \
182 --build
=$(GNU_HOST_NAME
) \
186 --sbindir
=/usr
/sbin \
187 --libexecdir
=/usr
/lib \
189 --datadir=/usr
/share \
190 --localstatedir
=/var \
192 --infodir=/usr
/info \
198 define Build
/Configure
199 $(call Build
/Configure
/Default
,)
202 define Build
/Compile
/Default
203 $(MAKE
) -C
$(PKG_BUILD_DIR
) \
205 CROSS
="$(TARGET_CROSS)" \
206 PREFIX
="$$(IDIR_$(1))" \
207 EXTRA_CFLAGS
="$(TARGET_CFLAGS)" \
209 DESTDIR
="$$(IDIR_$(1))"
213 $(call Build
/Compile
/Default
)
228 source
: $(DL_DIR
)/$(PKG_SOURCE
)
229 prepare
: $(PKG_BUILD_DIR
)/.prepared
230 configure
: $(PKG_BUILD_DIR
)/.configured
233 compile
: compile-targets
236 install: install-targets
240 @
$(MAKE
) clean-targets
241 rm -rf
$(PKG_BUILD_DIR
)