1 # This file is part of the OpenADK project. OpenADK is copyrighted
2 # material, please see the LICENCE file in the top-level directory.
6 # does not change CONFIGURE_ARGS in minimal mode
7 ifeq ($(filter minimal
,${CONFIG_STYLE}),)
9 CONFIGURE_ARGS
+= --enable-debug
13 AUTOTOOL_ENV
+= PATH
='${HOST_PATH}' \
14 PKG_CONFIG_LIBDIR
='${STAGING_TARGET_DIR}/usr/lib/pkgconfig:${STAGING_TARGET_DIR}/usr/share/pkgconfig' \
15 PKG_CONFIG_SYSROOT_DIR
='${STAGING_TARGET_DIR}' \
18 MESON_ENV
+= PATH
='${HOST_PATH}' \
19 PKG_CONFIG_LIBDIR
='${STAGING_TARGET_DIR}/usr/lib/pkgconfig:${STAGING_TARGET_DIR}/usr/share/pkgconfig' \
20 PKG_CONFIG_SYSROOT_DIR
='${STAGING_TARGET_DIR}'
22 CONFIGURE_ENV
+= PATH
='${TARGET_PATH}' \
25 PKG_CONFIG_LIBDIR
='${STAGING_TARGET_DIR}/usr/lib/pkgconfig:${STAGING_TARGET_DIR}/usr/share/pkgconfig' \
26 PKG_CONFIG_SYSROOT_DIR
='${STAGING_TARGET_DIR}' \
29 CONFIGURE_PROG?
= configure
31 # this is environment for 'make all' and 'make install'
33 # this is arguments for 'make all' and 'make install'
35 # this is arguments for 'make all' ONLY
37 # this is arguments for 'make install' ONLY
40 INSTALL_TARGET?
= install
42 MAKE_ENV
+= PATH
='${TARGET_PATH}' \
45 PKG_CONFIG_LIBDIR
='${STAGING_TARGET_DIR}/usr/lib/pkgconfig:${STAGING_TARGET_DIR}/usr/share/pkgconfig' \
46 PKG_CONFIG_SYSROOT_DIR
='${STAGING_TARGET_DIR}' \
47 WRKDIR
='${WRKDIR}' WRKDIST
='${WRKDIST}' \
48 WRKSRC
='${WRKSRC}' WRKBUILD
='${WRKBUILD}'
50 MAKE_FLAGS
+= ${XAKE_FLAGS}
51 FAKE_FLAGS
+= ${XAKE_FLAGS}
53 ifeq ($(strip ${WRKDIR_BSD}),)
54 WRKDIR_BASE
:= ${BUILD_DIR}
56 WRKDIR_BASE
:= $(shell pwd
)
59 _EXTRACT_COOKIE
= ${WRKDIST}/.extract_done
60 _PATCH_COOKIE
= ${WRKDIST}/.prepared
61 _CONFIGURE_COOKIE
= ${WRKBUILD}/.configure_done
62 _BUILD_COOKIE
= ${WRKBUILD}/.build_done
63 _FAKE_COOKIE
= ${WRKINST}/.fake_done
64 _IPKGS_COOKIE
= ${STAGING_PKG_DIR}/stamps
/${PKG_NAME}\x01${PKG_VERSION}-${PKG_RELEASE}
67 include ${ADK_TOPDIR}/mk
/buildhlp.mk
69 # defined in buildhlp.mk ('extract' can fail, use 'patch' then)
70 extract
: ${_EXTRACT_COOKIE}
71 patch
: ${_PATCH_COOKIE}
73 # defined below (will be moved to pkg-bottom.mk!)
74 configure
: ${_CONFIGURE_COOKIE}
75 build
: ${_BUILD_COOKIE}
78 # our recursive build entry point
79 build-all-pkgs
: ${_IPKGS_COOKIE}
81 # there are some parameters to the PKG_template function
82 # 1.) Config.in identifier ADK_PACKAGE_$(1)
83 # 2.) name of the package, for single package mostly $(PKG_NAME)
84 # 3.) package version (upstream version) and package release (adk version),
85 # always $(PKG_VERSION)-$(PKG_RELEASE)
86 # 4.) dependencies to other packages, $(PKG_DEPENDS)
87 # 5.) description for the package, $(PKG_DESCR)
88 # 6.) section of the package, $(PKG_SECTION)
89 # 7.) special package options $(PKG_OPTS)
90 # noscripts -> do not install scripts to $(STAGING_TARGET_DIR)/scripts
91 # (needed for example for autoconf/automake)
92 # noremove -> do not remove files from $(STAGING_TARGET_DIR) while
93 # cleaning (needed for toolchain packages like glibc)
94 # nostaging -> do not install files to $(STAGING_TARGET_DIR)
95 # nostrip -> do not strip files
96 # dev -> create a development subpackage with headers and pkg-config files
97 # devonly -> create a development package only
98 # should be package format independent and modular in the future
105 IPKG_
$(1)= $(PACKAGE_DIR
)/$(2)_
$(3)_
${ADK_TARGET_CPU_ARCH}.
${PKG_SUFFIX}
106 IPKG_
$(1)_DEV
= $(PACKAGE_DIR
)/$(2)-dev_
$(3)_
${ADK_TARGET_CPU_ARCH}.
${PKG_SUFFIX}
107 IPKG_
$(1)_DBG
= $(PACKAGE_DIR
)/$(2)-dbg_
$(3)_
${ADK_TARGET_CPU_ARCH}.
${PKG_SUFFIX}
108 IDIR_
$(1)= $(WRKDIR
)/fake-
${ADK_TARGET_CPU_ARCH}/pkg-
$(2)
109 IDIR_
$(1)_DEV
= $(WRKDIR
)/fake-
${ADK_TARGET_CPU_ARCH}/pkg-
$(2)-dev
110 IDIR_
$(1)_DBG
= $(WRKDIR
)/fake-
${ADK_TARGET_CPU_ARCH}/pkg-
$(2)-dbg
111 ifneq (${ADK_PACKAGE_
$(1)}${DEVELOPER},)
112 ifneq (,$(filter dev
,$(7)))
113 ifneq ($(ADK_TARGET_USE_STATIC_LIBS_ONLY
),y
)
114 ifneq ($(ADK_TARGET_BINFMT_FLAT
),y
)
115 ALL_IPKGS
+= $$(IPKG_
$(1))
116 ALL_IDIRS
+= $${IDIR_
$(1)}
117 ALL_POSTINST
+= $(2)-install
122 ALL_IPKGS
+= $$(IPKG_
$(1))
123 ALL_IDIRS
+= $${IDIR_
$(1)}
124 ALL_POSTINST
+= $(2)-install
128 INFO_
$(1)= $(PKG_STATE_DIR
)/info/$(2).list
129 INFO_
$(1)_DEV
= $(PKG_STATE_DIR
)/info/$(2)-dev.list
130 INFO_
$(1)_DBG
= $(PKG_STATE_DIR
)/info/$(2)-dbg.list
132 ifeq ($(ADK_PACKAGE_
$(1)),y
)
134 ifeq (,$(filter devonly
,$(7)))
135 ifeq ($(ADK_PACKAGE_
$(1)_DBG
),y
)
136 install-targets
: $$(INFO_
$(1)) $$(INFO_
$(1)_DBG
)
137 ifeq ($(ADK_PACKAGE_
$(1)_DEV
),y
)
138 install-targets
: $$(INFO_
$(1)) $$(INFO_
$(1)_DBG
) $$(INFO_
$(1)_DEV
)
140 install-targets
: $$(INFO_
$(1)) $$(INFO_
$(1)_DBG
)
143 ifeq ($(ADK_PACKAGE_
$(1)_DEV
),y
)
144 install-targets
: $$(INFO_
$(1)) $$(INFO_
$(1)_DEV
)
146 install-targets
: $$(INFO_
$(1))
150 install-targets
: $$(INFO_
$(1))
155 IDEPEND_
$(1):= $$(strip $(4))
157 _ALL_CONTROLS
+= $$(IDIR_
$(1))/CONTROL
/control
158 ICONTROL_
$(1)?
= $(WRKDIR
)/.
$(2).control
159 ICONTROL_
$(1)_DEV?
= $(WRKDIR
)/.
$(2)-dev.control
160 ICONTROL_
$(1)_DBG?
= $(WRKDIR
)/.
$(2)-dbg.control
161 $$(IDIR_
$(1))/CONTROL
/control
: ${_PATCH_COOKIE}
162 @echo
"Package: $$(shell echo $(2) | tr '_' '-')" > $(WRKDIR
)/.
$(2).control
163 @echo
"Section: $(6)" >> $(WRKDIR
)/.
$(2).control
164 @echo
"Description: $(5)" >> $(WRKDIR
)/.
$(2).control
165 @
${BASH} ${SCRIPT_DIR}/make-ipkg-dir.sh
$${IDIR_
$(1)} $${ICONTROL_
$(1)} $(3) ${ADK_TARGET_CPU_ARCH}
166 @adeps
='$$(strip $${IDEPEND_$(1)})'; if
[[ -n
$$$$adeps ]]; then \
170 for dep in
$$$$adeps; do \
171 if
[[ $$$$last = kernel
&& $$$$dep = \
(* ]]; then \
172 deps
="$$$$deps $$$$dep"; \
174 deps
="$$$$deps$$$$comma$$$$dep"; \
179 echo
"Depends: $$$$deps" | tr
'_' '-' >>$${IDIR_
$(1)}/CONTROL
/control
; \
181 @for file in conffiles preinst postinst prerm postrm
; do \
182 [ ! -f .
/files
/$(2).
$$$$file ] || cp .
/files
/$(2).
$$$$file $$(IDIR_
$(1))/CONTROL
/$$$$file; \
184 ifeq ($(ADK_BUILD_WITH_DEBUG
),y
)
185 @echo
"Package: $$(shell echo $(2) | tr '_' '-')-dbg" > $(WRKDIR
)/.
$(2)-dbg.control
186 @echo
"Section: debug" >> $(WRKDIR
)/.
$(2)-dbg.control
187 @echo
"Description: debugging symbols for $(2)" >> $(WRKDIR
)/.
$(2)-dbg.control
188 @
${BASH} ${SCRIPT_DIR}/make-ipkg-dir.sh
$${IDIR_
$(1)_DBG
} $${ICONTROL_
$(1)_DBG
} $(3) ${ADK_TARGET_CPU_ARCH}
189 @echo
"Depends: $$(shell echo $(2) | tr '_' '-')" >> $${IDIR_
$(1)_DBG
}/CONTROL
/control
191 ifneq (,$(filter dev
,$(7)))
192 @echo
"Package: $$(shell echo $(2) | tr '_' '-')-dev" > $(WRKDIR
)/.
$(2)-dev.control
193 @echo
"Section: devel" >> $(WRKDIR
)/.
$(2)-dev.control
194 @echo
"Description: development files for $(2)" >> $(WRKDIR
)/.
$(2)-dev.control
195 @
${BASH} ${SCRIPT_DIR}/make-ipkg-dir.sh
$${IDIR_
$(1)_DEV
} $${ICONTROL_
$(1)_DEV
} $(3) ${ADK_TARGET_CPU_ARCH}
196 @echo
"Depends: $$(shell echo $(2) | tr '_' '-')" >> $${IDIR_
$(1)_DEV
}/CONTROL
/control
199 $$(IPKG_
$(1)): $$(IDIR_
$(1))/CONTROL
/control
$${_FAKE_COOKIE}
200 ifeq (,$(filter nostrip
,$(7)))
202 @
$${RSTRIP} $${IDIR_
$(1)} $(MAKE_TRACE
)
204 ifeq ($(ADK_DEBUG_STRIP
),y
)
205 @
$${RSTRIP} $${IDIR_
$(1)} $(MAKE_TRACE
)
208 ifeq (${ADK_LEAVE_ETC_ALONE}$(filter force_etc
,$(7)),y
)
209 -rm -rf
$${IDIR_
$(1)}/etc
211 ifeq (${ADK_INSTALL_PACKAGE_INIT_SCRIPTS},y
)
212 @for file in
$$$$(ls .
/files
/*.init
2>/dev
/null
); do \
213 fname
=$$$$(echo
$$$$file| sed
-e
"s#.*/##" -e
"s#.init##"); \
214 check=$$$$(grep PKG
$$$$file|cut
-d
' ' -f
2); \
215 if
[ "$$$$check" == $(2) ];then \
216 mkdir
-p
$$(IDIR_
$(1))/etc
/init.d
&& cp
$$$$file $$(IDIR_
$(1))/etc
/init.d
/$$$$fname; \
219 @cd
$${IDIR_
$(1)}; for script in etc
/init.d
/*; do \
220 [[ -e
$$$$script ]] || continue
; \
221 chmod
0755 "$$$$script"; \
224 ifneq (${ADK_INSTALL_PACKAGE_NETWORK_SCRIPTS},y
)
225 -@
rm -rf
$${IDIR_
$(1)}/etc
/network
228 @mkdir
-p
$${PACKAGE_DIR} '$${STAGING_PKG_DIR}/stamps' \
229 '$${STAGING_TARGET_DIR}/scripts'
230 @for file in
$$$$(ls .
/files
/*.perm
2>/dev
/null
); do \
231 cat
$$$$file >> $${STAGING_TARGET_DIR}/scripts
/permissions.sh
; \
233 ifeq (,$(filter noremove
,$(7)))
234 @if
test -s
'$${STAGING_PKG_DIR}/$(1)'; then \
235 cd
'$${STAGING_TARGET_DIR}'; \
238 done
<'$${STAGING_PKG_DIR}/$(1)'; \
241 @
rm -f
'$${STAGING_PKG_DIR}/$(1)'
242 ifeq (,$(filter nostaging
,$(7)))
243 @
-cd
$${IDIR_
$(1)}; \
244 x
=$$$$(find tmp run
-mindepth
1 2>/dev
/null
); if
[[ -n
$$$$x ]]; then \
245 echo
'WARNING: $${IPKG_$(1)} installs files into a' \
246 'ramdisk location:' >&2; \
247 echo
"$$$$x" | sed
's/^/- /' >&2; \
249 find usr
! -type d
2>/dev
/null | \
250 grep
-E
-v
-e
'^usr/lib/pkgconfig' -e
'^usr/share' -e
'^usr/doc' -e
'^usr/src' -e
'^usr/man' \
251 -e
'^usr/info' -e
'^usr/lib/libc.so' -e
'^usr/bin/[a-z0-9-]+-config' -e
'^usr/lib/.*\.la$$$$' | \
252 tee
'$${STAGING_PKG_DIR}/$(1)' | \
253 $(CPIO
) -padlmu
--quiet
'$${STAGING_TARGET_DIR}'
255 ifeq (,$(filter noscripts
,$(7)))
256 @cd
'$${STAGING_TARGET_DIR}'; grep
'usr/s*bin/' \
257 '$${STAGING_PKG_DIR}/$(1)' | \
259 b
="$$$$(dd if="$$$$fn" bs=2 count=1 2>/dev/null)"; \
260 [[ $$$$b = '#!' ]] || continue
; \
261 cp
"$$$$fn" scripts
/; \
262 echo
"scripts/$$$$(basename "$$$$fn")" \
263 >>'$${STAGING_PKG_DIR}/$(1)'; \
267 ifeq (,$(filter devonly
,$(7)))
268 PATH
='$(HOST_PATH)' $${PKG_BUILD} $${IDIR_
$(1)} $${PACKAGE_DIR} $(MAKE_TRACE
)
269 ifneq ($(ADK_BUILD_WITH_DEBUG
),)
270 PATH
='$(HOST_PATH)' $${PKG_BUILD} $${IDIR_
$(1)_DBG
} $${PACKAGE_DIR} $(MAKE_TRACE
)
273 ifneq (,$(filter dev
,$(7)))
274 PATH
='$(HOST_PATH)' $${PKG_BUILD} $${IDIR_
$(1)_DEV
} $${PACKAGE_DIR} $(MAKE_TRACE
)
277 clean-targets
: clean-dev-
$(1)
280 ifeq (,$(filter noremove
,$(7)))
281 @if
test -s
'$${STAGING_PKG_DIR}/$(1)'; then \
282 cd
'$${STAGING_TARGET_DIR}'; \
285 done
<'$${STAGING_PKG_DIR}/$(1)'; \
288 @
rm -f
'$${STAGING_PKG_DIR}/$(1)'
290 $$(INFO_
$(1)): $$(IPKG_
$(1))
291 $(PKG_INSTALL
) $$(IPKG_
$(1))
293 $$(INFO_
$(1)_DBG
): $$(IPKG_
$(1)_DBG
)
294 $(PKG_INSTALL
) $$(IPKG_
$(1)_DBG
)
296 ifneq ($(1),UCLIBC_NG
)
299 $$(INFO_
$(1)_DEV
): $$(IPKG_
$(1)_DEV
)
300 $(PKG_INSTALL
) $$(IPKG_
$(1)_DEV
)
309 @
$(CMD_TRACE
) "installing.. "
310 @
$(MAKE
) install-targets
$(MAKE_TRACE
)
314 @printf
" ---> cleaning package build directories and files.. "
315 @
$(MAKE
) clean-targets
$(MAKE_TRACE
)
316 rm -rf
${WRKDIR} ${ALL_IPKGS} ${_IPKGS_COOKIE}
320 rm -f
${FULLDISTFILES}
322 .PHONY
: all refetch extract patch configure \
323 build fake package
install clean build-all-pkgs