root/trunk/freewrt/mk/buildhlp.mk

Revision 3818, 2.7 kB (checked in by tg, 1 month ago)

prefix paxmirabilis tools, WFM

Line 
1 # $FreeWRT$
2 #-
3 # This file is part of the FreeWRT project. FreeWRT is copyrighted
4 # material, please see the LICENCE file in the top-level directory
5 # or at http://www.freewrt.org/licence for details.
6
7 ifneq ($(strip ${MASTER_SITES}),)
8 ifeq ($(strip ${DISTFILES}),)
9 DISTFILES:=             ${PKG_NAME}-${PKG_VERSION}.tar.gz
10 endif
11 else ifneq ($(strip ${NO_DISTFILES}),1)
12 $(warning empty MASTER_SITES)
13 endif
14
15 # This is where all package operation is done in
16 WRKDIR?=                ${WRKDIR_BASE}/w-${PKG_NAME}-${PKG_VERSION}-${PKG_RELEASE}
17 # This is where source code is extracted and patched
18 WRKDIST?=               ${WRKDIR}/${PKG_NAME}-${PKG_VERSION}
19 # This is where the configure script is seeked (localed)
20 WRKSRC?=                ${WRKDIST}
21 # This is where configure, make and make install (fake) run from
22 WRKBUILD?=              ${WRKSRC}
23 # This is where make install (fake) writes to
24 WRKINST?=               ${WRKDIR}/fake-${ARCH}/root
25
26 ifeq ($(strip ${NO_CHECKSUM}),)
27 _CHECKSUM_COOKIE=       ${WRKDIR}/.checksum_done
28 else
29 _CHECKSUM_COOKIE=
30 endif
31
32 post-extract:
33
34 ifneq ($(strip ${DISTFILES}),)
35 include ${TOPDIR}/mk/fetch.mk
36
37 ${WRKDIST}/.extract_done: ${_CHECKSUM_COOKIE}
38 ifeq (${_CHECKSUM_COOKIE},)
39         rm -rf ${WRKDIST} ${WRKSRC} ${WRKBUILD}
40 endif
41         ${EXTRACT_CMD}
42 ifneq ($(strip ${CRLF_WORKAROUND}),)
43         perl -pi -e 's!\r$$!!g' $$(find ${WRKDIST} -type f)
44 endif
45         @${MAKE} post-extract
46         touch $@
47
48 __use_generic_patch_target:=42
49 else ifeq ($(strip ${NO_DISTFILES}),1)
50 ${WRKDIST}/.extract_done:
51         rm -rf ${WRKDIST} ${WRKSRC} ${WRKBUILD}
52         mkdir -p ${WRKDIR} ${WRKDIST}
53         ${MAKE} do-extract
54         @${MAKE} post-extract
55         touch $@
56
57 fetch refetch checksum do-extract:
58
59 __use_generic_patch_target:=42
60 else ifeq ($(strip ${_IN_PACKAGE}),1)
61 $(warning This package does not use the generic extraction and patch target; it's most likely to fail.)
62 endif
63
64 ifeq ($(strip ${__use_generic_patch_target}),42)
65 post-patch:
66 ${WRKDIST}/.prepared: ${WRKDIST}/.extract_done
67         [ ! -d ./patches ] || ${PREVENT_PATCH} ${PATCH} ${WRKDIST} ./patches \
68             '{patch-!(*.orig),*.patch}'
69         [ ! -d ./extra ] || (cd extra; $(PREVENT_PATCH) mirpax -rw . ${WRKDIST}/)
70         @${MAKE} post-patch
71         touch $@
72 endif
73
74 update-patches:
75         @test ! -d ${WRKDIR}.orig || rm -rf ${WRKDIR}.orig
76         @test ! -d ${WRKDIR}.orig
77 ifeq ($(strip ${_IN_PACKAGE})$(strip ${_IN_CVTC}),1)
78         @$(MAKE) -s V=0 patch WRKDIR=${WRKDIR}.orig PREVENT_PATCH=: NO_CHECKSUM=1
79 else
80         @$(MAKE) -s V=0 prepare WRKDIR=${WRKDIR}.orig PREVENT_PATCH=: NO_CHECKSUM=1
81 endif
82         @toedit=$$(WRKDIST='${WRKDIST}' CURDIR=$$(pwd) \
83             PATCH_LIST='patch-* *.patch' WRKDIR1='${WRKDIR}' \
84             ${MBSH} ${TOPDIR}/scripts/update-patches); \
85             if [[ -n $$toedit && $$toedit != FAIL ]]; then \
86                 echo -n 'edit patches: '; read i; \
87                 cd patches && $${VISUAL:-$${EDITOR:-/usr/bin/vi}} $$toedit; \
88             fi; \
89             rm -rf ${WRKDIR}.orig; \
90             [[ $$toedit != FAIL ]]
91
92 .PHONY: update-patches
Note: See TracBrowser for help on using the browser.