7 define Build
/DefaultTargets
8 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
)
15 $(PKG_BUILD_DIR
)/.configured
: prepared
16 $(call Build
/Configure
)
19 built
: FORCE
$(PKG_BUILD_DIR
)/.configured
20 ifneq ($$(shell $(SCRIPT_DIR
)/timestamp.pl
-p
-x ipkg
$(IPKG_
$(1)) $(PKG_BUILD_DIR
)),$(IPKG_
$(1)))
27 define Build
/DefaultTargets
31 define Package
/Default
34 CATEGORY
:=Extra packages
36 MAINTAINER
:=OpenWrt Developers Team
<openwrt-devel@openwrt.org
>
37 SOURCE
:=$(patsubst $(TOPDIR
)/%,%,${shell pwd
})
38 VERSION
:=$(PKG_VERSION
)-$(PKG_RELEASE
)
48 $(eval
$(call Package
/Default
))
49 $(eval
$(call Package
/$(1)))
51 $(foreach FIELD
, TITLE CATEGORY PRIORITY VERSION
,
53 $$(error Package
/$(1) is missing the
$(FIELD
) field
)
61 ifeq ($(DESCRIPTION
),)
62 $(eval DESCRIPTION
:=$(TITLE
))
65 IPKG_
$(1):=$(PACKAGE_DIR
)/$(1)_
$(VERSION
)_
$(PKGARCH
).ipk
66 IDIR_
$(1):=$(PKG_BUILD_DIR
)/ipkg
/$(1)
67 INFO_
$(1):=$(IPKG_STATE_DIR
)/info/$(1).list
69 ifneq ($(CONFIG_PACKAGE_
$(1))$(DEVELOPER
),)
73 ifeq ($(CONFIG_PACKAGE_
$(1)),y
)
74 install-targets
: $$(INFO_
$(1))
77 ifneq ($(COMPILE_
$(1)),)
78 compile-targets
: $(IPKG_
$(1))
81 IDEPEND_
$(1):=$$(strip $$(DEPENDS
))
93 echo
"Default: $(DEFAULT)";
97 echo
"Version: $(VERSION)"; \
98 echo
"Depends: $$(IDEPEND_$(1))"; \
99 echo
"Category: $(CATEGORY)"; \
100 echo
"Title: $(TITLE)"; \
101 echo
"Description: $(DESCRIPTION)" | sed
-e
's,\\,\n,g';
112 $$(IDIR_
$(1))/CONTROL
/control
: prepared
113 mkdir
-p
$$(IDIR_
$(1))/CONTROL
114 echo
"Package: $(1)" > $$(IDIR_
$(1))/CONTROL
/control
115 echo
"Version: $(VERSION)" >> $$(IDIR_
$(1))/CONTROL
/control
116 echo
"Depends: $$(IDEPEND_$(1))" >> $$(IDIR_
$(1))/CONTROL
/control
117 echo
"Source: $(SOURCE)" >> $$(IDIR_
$(1))/CONTROL
/control
118 echo
"Section: $(SECTION)" >> $$(IDIR_
$(1))/CONTROL
/control
119 echo
"Priority: $(PRIORITY)" >> $$(IDIR_
$(1))/CONTROL
/control
120 echo
"Maintainer: $(MAINTAINER)" >> $$(IDIR_
$(1))/CONTROL
/control
121 echo
"Architecture: $(PKGARCH)" >> $$(IDIR_
$(1))/CONTROL
/control
122 echo
"Description: $(DESCRIPTION)" | sed
-e
's,\\,\n ,g' >> $$(IDIR_
$(1))/CONTROL
/control
123 chmod
644 $$(IDIR_
$(1))/CONTROL
/control
124 for file in conffiles preinst postinst prerm postrm
; do \
125 [ -f .
/ipkg
/$(1).
$$$$file ] && cp .
/ipkg
/$(1).
$$$$file $$(IDIR_
$(1))/CONTROL
/$$$$file || true
; \
128 $$(IPKG_
$(1)): $$(IDIR_
$(1))/CONTROL
/control built
129 $(call Package
/$(1)/install,$$(IDIR_
$(1)))
130 mkdir
-p
$(PACKAGE_DIR
)
131 $(RSTRIP
) $$(IDIR_
$(1))
132 $(IPKG_BUILD
) $$(IDIR_
$(1)) $(PACKAGE_DIR
)
134 $$(INFO_
$(1)): $$(IPKG_
$(1))
135 $(IPKG
) install $$(IPKG_
$(1))
138 rm -f
$(PACKAGE_DIR
)/$(1)_
*
142 ifneq ($(__DEFAULT_TARGETS
),1)
143 $$(eval
$$(call Build
/DefaultTargets
,$(1)))
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 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
)