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 CONFIGURE_ENV
+= PATH
='${TARGET_PATH}' \
21 PKG_CONFIG_LIBDIR
='${STAGING_TARGET_DIR}/usr/lib/pkgconfig:${STAGING_TARGET_DIR}/usr/share/pkgconfig' \
22 PKG_CONFIG_SYSROOT_DIR
='${STAGING_TARGET_DIR}' \
25 CONFIGURE_PROG?
= configure
27 # this is environment for 'make all' and 'make install'
29 # this is arguments for 'make all' and 'make install'
31 # this is arguments for 'make all' ONLY
33 # this is arguments for 'make install' ONLY
36 INSTALL_TARGET?
= install
38 MAKE_ENV
+= PATH
='${TARGET_PATH}' \
41 PKG_CONFIG_LIBDIR
='${STAGING_TARGET_DIR}/usr/lib/pkgconfig:${STAGING_TARGET_DIR}/usr/share/pkgconfig' \
42 PKG_CONFIG_SYSROOT_DIR
='${STAGING_TARGET_DIR}' \
43 WRKDIR
='${WRKDIR}' WRKDIST
='${WRKDIST}' \
44 WRKSRC
='${WRKSRC}' WRKBUILD
='${WRKBUILD}'
46 MAKE_FLAGS
+= ${XAKE_FLAGS}
47 FAKE_FLAGS
+= ${XAKE_FLAGS}
49 ifeq ($(strip ${WRKDIR_BSD}),)
50 WRKDIR_BASE
:= ${BUILD_DIR}
52 WRKDIR_BASE
:= $(shell pwd
)
55 _EXTRACT_COOKIE
= ${WRKDIST}/.extract_done
56 _PATCH_COOKIE
= ${WRKDIST}/.prepared
57 _CONFIGURE_COOKIE
= ${WRKBUILD}/.configure_done
58 _BUILD_COOKIE
= ${WRKBUILD}/.build_done
59 _FAKE_COOKIE
= ${WRKINST}/.fake_done
60 _IPKGS_COOKIE
= ${STAGING_PKG_DIR}/stamps
/${PKG_NAME}\x01${PKG_VERSION}-${PKG_RELEASE}
63 include ${ADK_TOPDIR}/mk
/buildhlp.mk
65 # defined in buildhlp.mk ('extract' can fail, use 'patch' then)
66 extract
: ${_EXTRACT_COOKIE}
67 patch
: ${_PATCH_COOKIE}
69 # defined below (will be moved to pkg-bottom.mk!)
70 configure
: ${_CONFIGURE_COOKIE}
71 build
: ${_BUILD_COOKIE}
74 # our recursive build entry point
75 build-all-pkgs
: ${_IPKGS_COOKIE}
77 # there are some parameters to the PKG_template function
78 # 1.) Config.in identifier ADK_PACKAGE_$(1)
79 # 2.) name of the package, for single package mostly $(PKG_NAME)
80 # 3.) package version (upstream version) and package release (adk version),
81 # always $(PKG_VERSION)-$(PKG_RELEASE)
82 # 4.) dependencies to other packages, $(PKG_DEPENDS)
83 # 5.) description for the package, $(PKG_DESCR)
84 # 6.) section of the package, $(PKG_SECTION)
85 # 7.) special package options $(PKG_OPTS)
86 # noscripts -> do not install scripts to $(STAGING_TARGET_DIR)/scripts
87 # (needed for example for autoconf/automake)
88 # noremove -> do not remove files from $(STAGING_TARGET_DIR) while
89 # cleaning (needed for toolchain packages like glibc)
90 # nostaging -> do not install files to $(STAGING_TARGET_DIR)
91 # nostrip -> do not strip files
92 # dev -> create a development subpackage with headers and pkg-config files
93 # devonly -> create a development package only
94 # should be package format independent and modular in the future
101 IPKG_
$(1)= $(PACKAGE_DIR
)/$(2)_
$(3)_
${ADK_TARGET_CPU_ARCH}.
${PKG_SUFFIX}
102 IPKG_
$(1)_DEV
= $(PACKAGE_DIR
)/$(2)-dev_
$(3)_
${ADK_TARGET_CPU_ARCH}.
${PKG_SUFFIX}
103 IPKG_
$(1)_DBG
= $(PACKAGE_DIR
)/$(2)-dbg_
$(3)_
${ADK_TARGET_CPU_ARCH}.
${PKG_SUFFIX}
104 IDIR_
$(1)= $(WRKDIR
)/fake-
${ADK_TARGET_CPU_ARCH}/pkg-
$(2)
105 IDIR_
$(1)_DEV
= $(WRKDIR
)/fake-
${ADK_TARGET_CPU_ARCH}/pkg-
$(2)-dev
106 IDIR_
$(1)_DBG
= $(WRKDIR
)/fake-
${ADK_TARGET_CPU_ARCH}/pkg-
$(2)-dbg
107 ifneq (${ADK_PACKAGE_
$(1)}${DEVELOPER},)
108 ifneq (,$(filter dev
,$(7)))
109 ifneq ($(ADK_TARGET_USE_STATIC_LIBS_ONLY
),y
)
110 ifneq ($(ADK_TARGET_BINFMT_FLAT
),y
)
111 ALL_IPKGS
+= $$(IPKG_
$(1))
112 ALL_IDIRS
+= $${IDIR_
$(1)}
113 ALL_POSTINST
+= $(2)-install
118 ALL_IPKGS
+= $$(IPKG_
$(1))
119 ALL_IDIRS
+= $${IDIR_
$(1)}
120 ALL_POSTINST
+= $(2)-install
124 INFO_
$(1)= $(PKG_STATE_DIR
)/info/$(2).list
125 INFO_
$(1)_DEV
= $(PKG_STATE_DIR
)/info/$(2)-dev.list
126 INFO_
$(1)_DBG
= $(PKG_STATE_DIR
)/info/$(2)-dbg.list
128 ifeq ($(ADK_PACKAGE_
$(1)),y
)
130 ifeq (,$(filter devonly
,$(7)))
131 ifeq ($(ADK_PACKAGE_
$(1)_DBG
),y
)
132 install-targets
: $$(INFO_
$(1)) $$(INFO_
$(1)_DBG
)
133 ifeq ($(ADK_PACKAGE_
$(1)_DEV
),y
)
134 install-targets
: $$(INFO_
$(1)) $$(INFO_
$(1)_DBG
) $$(INFO_
$(1)_DEV
)
136 install-targets
: $$(INFO_
$(1)) $$(INFO_
$(1)_DBG
)
139 ifeq ($(ADK_PACKAGE_
$(1)_DEV
),y
)
140 install-targets
: $$(INFO_
$(1)) $$(INFO_
$(1)_DEV
)
142 install-targets
: $$(INFO_
$(1))
146 install-targets
: $$(INFO_
$(1))
151 IDEPEND_
$(1):= $$(strip $(4))
153 _ALL_CONTROLS
+= $$(IDIR_
$(1))/CONTROL
/control
154 ICONTROL_
$(1)?
= $(WRKDIR
)/.
$(2).control
155 ICONTROL_
$(1)_DEV?
= $(WRKDIR
)/.
$(2)-dev.control
156 ICONTROL_
$(1)_DBG?
= $(WRKDIR
)/.
$(2)-dbg.control
157 $$(IDIR_
$(1))/CONTROL
/control
: ${_PATCH_COOKIE}
158 @echo
"Package: $$(shell echo $(2) | tr '_' '-')" > $(WRKDIR
)/.
$(2).control
159 @echo
"Section: $(6)" >> $(WRKDIR
)/.
$(2).control
160 @echo
"Description: $(5)" >> $(WRKDIR
)/.
$(2).control
161 @
${BASH} ${SCRIPT_DIR}/make-ipkg-dir.sh
$${IDIR_
$(1)} $${ICONTROL_
$(1)} $(3) ${ADK_TARGET_CPU_ARCH}
162 @adeps
='$$(strip $${IDEPEND_$(1)})'; if
[[ -n
$$$$adeps ]]; then \
166 for dep in
$$$$adeps; do \
167 if
[[ $$$$last = kernel
&& $$$$dep = \
(* ]]; then \
168 deps
="$$$$deps $$$$dep"; \
170 deps
="$$$$deps$$$$comma$$$$dep"; \
175 echo
"Depends: $$$$deps" | tr
'_' '-' >>$${IDIR_
$(1)}/CONTROL
/control
; \
177 @for file in conffiles preinst postinst prerm postrm
; do \
178 [ ! -f .
/files
/$(2).
$$$$file ] || cp .
/files
/$(2).
$$$$file $$(IDIR_
$(1))/CONTROL
/$$$$file; \
180 ifeq ($(ADK_BUILD_WITH_DEBUG
),y
)
181 @echo
"Package: $$(shell echo $(2) | tr '_' '-')-dbg" > $(WRKDIR
)/.
$(2)-dbg.control
182 @echo
"Section: debug" >> $(WRKDIR
)/.
$(2)-dbg.control
183 @echo
"Description: debugging symbols for $(2)" >> $(WRKDIR
)/.
$(2)-dbg.control
184 @
${BASH} ${SCRIPT_DIR}/make-ipkg-dir.sh
$${IDIR_
$(1)_DBG
} $${ICONTROL_
$(1)_DBG
} $(3) ${ADK_TARGET_CPU_ARCH}
185 @echo
"Depends: $$(shell echo $(2) | tr '_' '-')" >> $${IDIR_
$(1)_DBG
}/CONTROL
/control
187 ifneq (,$(filter dev
,$(7)))
188 @echo
"Package: $$(shell echo $(2) | tr '_' '-')-dev" > $(WRKDIR
)/.
$(2)-dev.control
189 @echo
"Section: devel" >> $(WRKDIR
)/.
$(2)-dev.control
190 @echo
"Description: development files for $(2)" >> $(WRKDIR
)/.
$(2)-dev.control
191 @
${BASH} ${SCRIPT_DIR}/make-ipkg-dir.sh
$${IDIR_
$(1)_DEV
} $${ICONTROL_
$(1)_DEV
} $(3) ${ADK_TARGET_CPU_ARCH}
192 @echo
"Depends: $$(shell echo $(2) | tr '_' '-')" >> $${IDIR_
$(1)_DEV
}/CONTROL
/control
195 $$(IPKG_
$(1)): $$(IDIR_
$(1))/CONTROL
/control
$${_FAKE_COOKIE}
196 ifeq (,$(filter nostrip
,$(7)))
198 @
$${RSTRIP} $${IDIR_
$(1)} $(MAKE_TRACE
)
200 ifeq ($(ADK_DEBUG_STRIP
),y
)
201 @
$${RSTRIP} $${IDIR_
$(1)} $(MAKE_TRACE
)
204 ifeq (${ADK_LEAVE_ETC_ALONE}$(filter force_etc
,$(7)),y
)
205 -rm -rf
$${IDIR_
$(1)}/etc
207 ifeq (${ADK_INSTALL_PACKAGE_INIT_SCRIPTS},y
)
208 @for file in
$$$$(ls .
/files
/*.init
2>/dev
/null
); do \
209 fname
=$$$$(echo
$$$$file| sed
-e
"s#.*/##" -e
"s#.init##"); \
210 check=$$$$(grep PKG
$$$$file|cut
-d
' ' -f
2); \
211 if
[ "$$$$check" == $(2) ];then \
212 mkdir
-p
$$(IDIR_
$(1))/etc
/init.d
&& cp
$$$$file $$(IDIR_
$(1))/etc
/init.d
/$$$$fname; \
215 @cd
$${IDIR_
$(1)}; for script in etc
/init.d
/*; do \
216 [[ -e
$$$$script ]] || continue
; \
217 chmod
0755 "$$$$script"; \
220 ifneq (${ADK_INSTALL_PACKAGE_NETWORK_SCRIPTS},y
)
221 -@
rm -rf
$${IDIR_
$(1)}/etc
/network
223 ifeq (${ADK_RUNTIME_INIT_SYSTEMD},y
)
224 @for file in
$$$$(ls .
/files
/*.service
2>/dev
/null
); do \
225 fname
=$$$$(echo
$$$$file| sed
-e
"s#.*/##"); \
226 mkdir
-p
$$(IDIR_
$(1))/usr
/lib
/systemd
/system
&& cp
$$$$file $$(IDIR_
$(1))/usr
/lib
/systemd
/system
/$$$$fname; \
227 mkdir
-p
$$(IDIR_
$(1))/etc
/systemd
/system
/multi-user.target.wants
; \
228 ln
-sf ..
/..
/..
/..
/usr
/lib
/systemd
/system
/$$$$fname \
229 $$(IDIR_
$(1))/etc
/systemd
/system
/multi-user.target.wants
; \
233 @mkdir
-p
$${PACKAGE_DIR} '$${STAGING_PKG_DIR}/stamps' \
234 '$${STAGING_TARGET_DIR}/scripts'
235 @for file in
$$$$(ls .
/files
/*.perm
2>/dev
/null
); do \
236 cat
$$$$file >> $${STAGING_TARGET_DIR}/scripts
/permissions.sh
; \
238 ifeq (,$(filter noremove
,$(7)))
239 @if
test -s
'$${STAGING_PKG_DIR}/$(1)'; then \
240 cd
'$${STAGING_TARGET_DIR}'; \
243 done
<'$${STAGING_PKG_DIR}/$(1)'; \
246 @
rm -f
'$${STAGING_PKG_DIR}/$(1)'
247 ifeq (,$(filter nostaging
,$(7)))
248 @
-cd
$${IDIR_
$(1)}; \
249 x
=$$$$(find tmp run
-mindepth
1 2>/dev
/null
); if
[[ -n
$$$$x ]]; then \
250 echo
'WARNING: $${IPKG_$(1)} installs files into a' \
251 'ramdisk location:' >&2; \
252 echo
"$$$$x" | sed
's/^/- /' >&2; \
254 find usr
! -type d
2>/dev
/null | \
255 grep
-E
-v
-e
'^usr/lib/pkgconfig' -e
'^usr/share' -e
'^usr/doc' -e
'^usr/src' -e
'^usr/man' \
256 -e
'^usr/info' -e
'^usr/lib/libc.so' -e
'^usr/bin/[a-z0-9-]+-config' -e
'^usr/lib/.*\.la$$$$' | \
257 tee
'$${STAGING_PKG_DIR}/$(1)' | \
258 $(CPIO
) -padlmu
--quiet
'$${STAGING_TARGET_DIR}'
260 ifeq (,$(filter noscripts
,$(7)))
261 @cd
'$${STAGING_TARGET_DIR}'; grep
'usr/s*bin/' \
262 '$${STAGING_PKG_DIR}/$(1)' | \
264 b
="$$$$(dd if="$$$$fn" bs=2 count=1 2>/dev/null)"; \
265 [[ $$$$b = '#!' ]] || continue
; \
266 cp
"$$$$fn" scripts
/; \
267 echo
"scripts/$$$$(basename "$$$$fn")" \
268 >>'$${STAGING_PKG_DIR}/$(1)'; \
272 ifeq (,$(filter devonly
,$(7)))
273 PATH
='$(HOST_PATH)' $${PKG_BUILD} $${IDIR_
$(1)} $${PACKAGE_DIR} $(MAKE_TRACE
)
274 ifneq ($(ADK_BUILD_WITH_DEBUG
),)
275 PATH
='$(HOST_PATH)' $${PKG_BUILD} $${IDIR_
$(1)_DBG
} $${PACKAGE_DIR} $(MAKE_TRACE
)
278 ifneq (,$(filter dev
,$(7)))
279 PATH
='$(HOST_PATH)' $${PKG_BUILD} $${IDIR_
$(1)_DEV
} $${PACKAGE_DIR} $(MAKE_TRACE
)
282 clean-targets
: clean-dev-
$(1)
285 ifeq (,$(filter noremove
,$(7)))
286 @if
test -s
'$${STAGING_PKG_DIR}/$(1)'; then \
287 cd
'$${STAGING_TARGET_DIR}'; \
290 done
<'$${STAGING_PKG_DIR}/$(1)'; \
293 @
rm -f
'$${STAGING_PKG_DIR}/$(1)'
295 $$(INFO_
$(1)): $$(IPKG_
$(1))
296 $(PKG_INSTALL
) $$(IPKG_
$(1))
298 $$(INFO_
$(1)_DBG
): $$(IPKG_
$(1)_DBG
)
299 $(PKG_INSTALL
) $$(IPKG_
$(1)_DBG
)
301 ifneq ($(1),UCLIBC_NG
)
304 $$(INFO_
$(1)_DEV
): $$(IPKG_
$(1)_DEV
)
305 $(PKG_INSTALL
) $$(IPKG_
$(1)_DEV
)
314 @
$(CMD_TRACE
) "installing.. "
315 @
$(MAKE
) install-targets
$(MAKE_TRACE
)
319 @printf
" ---> cleaning package build directories and files.. "
320 @
$(MAKE
) clean-targets
$(MAKE_TRACE
)
321 rm -rf
${WRKDIR} ${ALL_IPKGS} ${_IPKGS_COOKIE}
325 rm -f
${FULLDISTFILES}
327 .PHONY
: all refetch extract patch configure \
328 build fake package
install clean build-all-pkgs