1 # This file is part of the OpenADK project. OpenADK is copyrighted
2 # material, please see the LICENCE file in the top-level directory.
4 shellescape
='$(subst ','\'',$(1))'
5 shellexport=$(1)=$(call shellescape,${$(1)})
7 ifneq ($(strip ${PKG_SITES}),)
8 ifeq ($(strip ${DISTFILES}),)
9 DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.xz
13 # This is where all package operation is done in
14 WRKDIR?= ${WRKDIR_BASE}/w-${PKG_NAME}-${PKG_VERSION}-${PKG_RELEASE}
15 # This is where source code is extracted and patched
16 WRKDIST?= ${WRKDIR}/${PKG_NAME}-${PKG_VERSION}
17 # This is where the configure script is seeked (localed)
19 # This is where configure, make and make install (fake) run from
21 # This is where make install (fake) writes to
22 WRKINST?= ${WRKDIR}/fake-${ADK_TARGET_CPU_ARCH}/root
24 ifeq ($(strip ${PKG_NOCHECKSUM}),)
25 _CHECKSUM_COOKIE= ${WRKDIR}/.checksum_done
31 ifeq ($(strip ${NO_DISTFILES}),1)
32 ${WRKDIST}/.extract_done:
33 rm -rf ${WRKDIST} ${WRKSRC} ${WRKBUILD}
34 @mkdir -p ${WRKDIR} ${WRKDIST}
36 @${MAKE} post-extract $(MAKE_TRACE)
39 fetch refetch checksum do-extract:
41 __use_generic_patch_target:=42
42 else ifneq ($(strip ${DISTFILES}),)
43 include ${ADK_TOPDIR}/mk/fetch.mk
45 ${WRKDIST}/.extract_done: ${_CHECKSUM_COOKIE}
46 ifeq (${_CHECKSUM_COOKIE},)
47 rm -rf ${WRKDIST} ${WRKSRC} ${WRKBUILD}
49 ifeq ($(EXTRACT_OVERRIDE),1)
54 @${MAKE} post-extract $(MAKE_TRACE)
57 __use_generic_patch_target:=42
59 include ${ADK_TOPDIR}/mk/fetch.mk
60 ${WRKDIST}/.extract_done: ${_CHECKSUM_COOKIE}
62 ifeq (${_CHECKSUM_COOKIE},)
63 rm -rf ${WRKDIST} ${WRKSRC} ${WRKBUILD}
65 ifeq ($(EXTRACT_OVERRIDE),1)
70 @${MAKE} post-extract $(MAKE_TRACE)
74 ifeq ($(strip ${__use_generic_patch_target}),42)
76 ${WRKDIST}/.prepared: ${WRKDIST}/.extract_done
77 [ ! -d ./patches/${PKG_VERSION} ] || ${PREVENT_PATCH} ${PATCH} ${WRKDIST} ./patches/${PKG_VERSION} \
78 '{patch-
!(*.orig
),*.patch
,*.
${ADK_TARGET_ARCH},*.
${ADK_TARGET_LIBC}}' $(MAKE_TRACE)
79 [ ! -d ./patches ] || ${PREVENT_PATCH} ${PATCH} ${WRKDIST} ./patches \
80 '{patch-
!(*.orig
),*.patch
,*.
${ADK_TARGET_ARCH},*.
${ADK_TARGET_LIBC}}' $(MAKE_TRACE)
81 [ ! -d ./src ] || (cd src; $(PREVENT_PATCH) cp -Rp . ${WRKDIST}/) \
83 @${MAKE} post-patch $(MAKE_TRACE)
84 @# always use latest config.sub/config.guess from OpenADK scripts directory
86 for i in $$(find . -name config.sub);do \
88 ${CP} ${SCRIPT_DIR}/config.sub $$i; \
91 for i in $$(find . -name config.guess);do \
93 ${CP} ${SCRIPT_DIR}/config.guess $$i; \
99 update-patches host-update-patches:
100 ifneq (${ADK_UPDATE_PATCHES_GIT},)
101 PATH='${HOST_PATH}' ${BASH} $(SCRIPT_DIR)/update-patches-git "${WRKDIST}"
103 @test ! -d ${WRKDIR}.orig || rm -rf ${WRKDIR}.orig
104 @test ! -d ${WRKDIR}.orig
105 ifeq ($(strip ${_IN_PACKAGE})$(strip ${_IN_CVTC}),1)
106 @$(MAKE) -s V=0 patch WRKDIR=${WRKDIR}.orig PREVENT_PATCH=: PKG_NOCHECKSUM=1
108 @$(MAKE) -s V=0 prepare WRKDIR=${WRKDIR}.orig PREVENT_PATCH=: PKG_NOCHECKSUM=1
110 @-test ! -r ${WRKDIR}/.autoreconf_done || \
111 (wrkdist=$(WRKDIST) dir=$${wrkdist#$(WRKDIR)}; \
112 cd ${WRKDIR}.orig$${dir}; \
113 env ${AUTOTOOL_ENV} autoreconf -if > /dev/null 2>&1; \
114 rm -rf ${WRKDIR}.orig$${dir}/autom4te.cache ) $(MAKE_TRACE)
115 @# restore config.sub/config.guess
116 @WRKDIST=$(call shellescape,${WRKDIST}) \
117 WRKDIR1=$(call shellescape,${WRKDIR}) \
118 PATH=$(call shellescape,${HOST_PATH}) \
119 $(call shellexport,DIFF_IGNOREFILES) \
120 mksh ${ADK_TOPDIR}/scripts/update-patches2
123 .PHONY: update-patches host-update-patches