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
227 ifeq (${ADK_RUNTIME_INIT_SYSTEMD},y
)
228 @for file in
$$$$(ls .
/files
/*.service
2>/dev
/null
); do \
229 fname
=$$$$(echo
$$$$file| sed
-e
"s#.*/##"); \
230 mkdir
-p
$$(IDIR_
$(1))/usr
/lib
/systemd
/system
&& cp
$$$$file $$(IDIR_
$(1))/usr
/lib
/systemd
/system
/$$$$fname; \
231 mkdir
-p
$$(IDIR_
$(1))/etc
/systemd
/system
/multi-user.target.wants
; \
232 ln
-sf ..
/..
/..
/..
/usr
/lib
/systemd
/system
/$$$$fname \
233 $$(IDIR_
$(1))/etc
/systemd
/system
/multi-user.target.wants
; \
237 @mkdir
-p
$${PACKAGE_DIR} '$${STAGING_PKG_DIR}/stamps' \
238 '$${STAGING_TARGET_DIR}/scripts'
239 @for file in
$$$$(ls .
/files
/*.perm
2>/dev
/null
); do \
240 cat
$$$$file >> $${STAGING_TARGET_DIR}/scripts
/permissions.sh
; \
242 ifeq (,$(filter noremove
,$(7)))
243 @if
test -s
'$${STAGING_PKG_DIR}/$(1)'; then \
244 cd
'$${STAGING_TARGET_DIR}'; \
247 done
<'$${STAGING_PKG_DIR}/$(1)'; \
250 @
rm -f
'$${STAGING_PKG_DIR}/$(1)'
251 ifeq (,$(filter nostaging
,$(7)))
252 @
-cd
$${IDIR_
$(1)}; \
253 x
=$$$$(find tmp run
-mindepth
1 2>/dev
/null
); if
[[ -n
$$$$x ]]; then \
254 echo
'WARNING: $${IPKG_$(1)} installs files into a' \
255 'ramdisk location:' >&2; \
256 echo
"$$$$x" | sed
's/^/- /' >&2; \
258 find usr
! -type d
2>/dev
/null | \
259 grep
-E
-v
-e
'^usr/lib/pkgconfig' -e
'^usr/share' -e
'^usr/doc' -e
'^usr/src' -e
'^usr/man' \
260 -e
'^usr/info' -e
'^usr/lib/libc.so' -e
'^usr/bin/[a-z0-9-]+-config' -e
'^usr/lib/.*\.la$$$$' | \
261 tee
'$${STAGING_PKG_DIR}/$(1)' | \
262 $(CPIO
) -padlmu
--quiet
'$${STAGING_TARGET_DIR}'
264 ifeq (,$(filter noscripts
,$(7)))
265 @cd
'$${STAGING_TARGET_DIR}'; grep
'usr/s*bin/' \
266 '$${STAGING_PKG_DIR}/$(1)' | \
268 b
="$$$$(dd if="$$$$fn" bs=2 count=1 2>/dev/null)"; \
269 [[ $$$$b = '#!' ]] || continue
; \
270 cp
"$$$$fn" scripts
/; \
271 echo
"scripts/$$$$(basename "$$$$fn")" \
272 >>'$${STAGING_PKG_DIR}/$(1)'; \
276 ifeq (,$(filter devonly
,$(7)))
277 PATH
='$(HOST_PATH)' $${PKG_BUILD} $${IDIR_
$(1)} $${PACKAGE_DIR} $(MAKE_TRACE
)
278 ifneq ($(ADK_BUILD_WITH_DEBUG
),)
279 PATH
='$(HOST_PATH)' $${PKG_BUILD} $${IDIR_
$(1)_DBG
} $${PACKAGE_DIR} $(MAKE_TRACE
)
282 ifneq (,$(filter dev
,$(7)))
283 PATH
='$(HOST_PATH)' $${PKG_BUILD} $${IDIR_
$(1)_DEV
} $${PACKAGE_DIR} $(MAKE_TRACE
)
286 clean-targets
: clean-dev-
$(1)
289 ifeq (,$(filter noremove
,$(7)))
290 @if
test -s
'$${STAGING_PKG_DIR}/$(1)'; then \
291 cd
'$${STAGING_TARGET_DIR}'; \
294 done
<'$${STAGING_PKG_DIR}/$(1)'; \
297 @
rm -f
'$${STAGING_PKG_DIR}/$(1)'
299 $$(INFO_
$(1)): $$(IPKG_
$(1))
300 $(PKG_INSTALL
) $$(IPKG_
$(1))
302 $$(INFO_
$(1)_DBG
): $$(IPKG_
$(1)_DBG
)
303 $(PKG_INSTALL
) $$(IPKG_
$(1)_DBG
)
305 ifneq ($(1),UCLIBC_NG
)
308 $$(INFO_
$(1)_DEV
): $$(IPKG_
$(1)_DEV
)
309 $(PKG_INSTALL
) $$(IPKG_
$(1)_DEV
)
318 @
$(CMD_TRACE
) "installing.. "
319 @
$(MAKE
) install-targets
$(MAKE_TRACE
)
323 @printf
" ---> cleaning package build directories and files.. "
324 @
$(MAKE
) clean-targets
$(MAKE_TRACE
)
325 rm -rf
${WRKDIR} ${ALL_IPKGS} ${_IPKGS_COOKIE}
329 rm -f
${FULLDISTFILES}
331 .PHONY
: all refetch extract patch configure \
332 build fake package
install clean build-all-pkgs