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 @# find any reject files and delete them
78 @find $(WRKDIST)/ -name \*.rej -delete
79 [ ! -d ./patches/${PKG_VERSION} ] || ${PREVENT_PATCH} ${PATCH} ${WRKDIST} ./patches/${PKG_VERSION} \
80 '{patch-
!(*.orig
),*.patch
,*.
${ADK_TARGET_ARCH},*.
${ADK_TARGET_LIBC}}' $(MAKE_TRACE)
81 [ ! -d ./patches ] || ${PREVENT_PATCH} ${PATCH} ${WRKDIST} ./patches \
82 '{patch-
!(*.orig
),*.patch
,*.
${ADK_TARGET_ARCH},*.
${ADK_TARGET_LIBC}}' $(MAKE_TRACE)
83 [ ! -d ./src ] || (cd src; $(PREVENT_PATCH) cp -Rp . ${WRKDIST}/) \
85 @${MAKE} post-patch $(MAKE_TRACE)
86 @# always use latest config.sub/config.guess from OpenADK scripts directory
88 for i in $$(find . -name config.sub);do \
90 ${CP} ${SCRIPT_DIR}/config.sub $$i; \
93 for i in $$(find . -name config.guess);do \
95 ${CP} ${SCRIPT_DIR}/config.guess $$i; \
101 update-patches host-update-patches:
102 ifneq (${ADK_UPDATE_PATCHES_GIT},)
103 PATH='${HOST_PATH}' ${BASH} $(SCRIPT_DIR)/update-patches-git "${WRKDIST}"
105 @test ! -d ${WRKDIR}.orig || rm -rf ${WRKDIR}.orig
106 @test ! -d ${WRKDIR}.orig
107 ifeq ($(strip ${_IN_PACKAGE})$(strip ${_IN_CVTC}),1)
108 @$(MAKE) -s V=0 patch WRKDIR=${WRKDIR}.orig PREVENT_PATCH=: PKG_NOCHECKSUM=1
110 @$(MAKE) -s V=0 prepare WRKDIR=${WRKDIR}.orig PREVENT_PATCH=: PKG_NOCHECKSUM=1
112 @-test ! -r ${WRKDIR}/.autoreconf_done || \
113 (wrkdist=$(WRKDIST) dir=$${wrkdist#$(WRKDIR)}; \
114 cd ${WRKDIR}.orig$${dir}; \
115 env ${AUTOTOOL_ENV} autoreconf -if > /dev/null 2>&1; \
116 rm -rf ${WRKDIR}.orig$${dir}/autom4te.cache ) $(MAKE_TRACE)
117 @# restore config.sub/config.guess
118 @WRKDIST=$(call shellescape,${WRKDIST}) \
119 WRKDIR1=$(call shellescape,${WRKDIR}) \
120 PATH=$(call shellescape,${HOST_PATH}) \
121 $(call shellexport,DIFF_IGNOREFILES) \
122 mksh ${ADK_TOPDIR}/scripts/update-patches2
125 .PHONY: update-patches host-update-patches