source: freewrt/mk/buildhlp.mk@ 655dec8

Last change on this file since 655dec8 was 512f2f5, checked in by Thorsten Glaser <tg@…>, 19 years ago

revert to use gmake 3.81 features

dnehring@: gmake 3.81 is delivered with FreeWRT now,
and I'll integrate it _even_ better tonight.

ok wbx@ austriancoder@

git-svn-id: svn://www.freewrt.org/trunk/freewrt@2221 afb5a338-a214-0410-bd46-81f09a774fd1

  • Property mode set to 100644
File size: 3.0 KB
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
7ifneq ($(strip ${PKG_SOURCE_URL}),)
8ifeq ($(strip ${PKG_SOURCE}),)
9PKG_SOURCE:= ${PKG_NAME}-${PKG_VERSION}.tar.gz
10endif
11endif
12ifneq ($(strip ${PKG_SOURCE}),)
13DISTFILES?= ${DL_DIR}/${PKG_SOURCE}
14endif
15
16# This is where all package operation is done in
17WRKDIR?= ${WRKDIR_BASE}/w-${PKG_NAME}-${PKG_VERSION}-${PKG_RELEASE}
18# This is where source code is extracted and patched
19WRKDIST?= ${WRKDIR}/${PKG_NAME}-${PKG_VERSION}
20# This is where the configure script is seeked (localed)
21WRKSRC?= ${WRKDIST}
22# This is where configure, make and make install (fake) run from
23WRKBUILD?= ${WRKSRC}
24# This is where make install (fake) writes to
25WRKINST?= ${WRKDIR}/fake-${ARCH}/root
26
27ifneq ($(strip ${PKG_SOURCE_URL}),)
28$(DL_DIR)/$(PKG_SOURCE):
29 @$(CMD_TRACE) "downloading... "
30 mkdir -p ${DL_DIR}
31 perl ${SCRIPT_DIR}/download.pl ${DL_DIR} ${PKG_SOURCE} \
32 ${PKG_MD5SUM} ${PKG_SOURCE_URL} ${MAKE_TRACE}
33endif
34
35post-extract:
36
37# no, this is not a failure
38checksum:
39 @echo "There is currently no way to checksum the" >&2
40 @echo "distfiles downloaded in FreeWRT. Sorry." >&2
41
42ifneq ($(strip ${DISTFILES})$(strip ${PKG_SOURCE}),)
43fetch: ${DISTFILES}
44refetch:
45 -rm -f ${DISTFILES}
46 ${MAKE} fetch
47
48# should depend on checksum later
49${WRKDIST}/.extract_done: ${DISTFILES}
50 rm -rf ${WRKDIST} ${WRKSRC} ${WRKBUILD}
51 ${EXTRACT_CMD}
52ifneq ($(strip ${CRLF_WORKAROUND}),)
53 perl -pi -e 's!\r$$!!g' $$(find ${WRKDIST} -type f)
54endif
55 @${MAKE} post-extract
56 touch $@
57
58__use_generic_patch_target:=42
59else ifeq ($(strip ${NO_DISTFILES}),1)
60${WRKDIST}/.extract_done:
61 rm -rf ${WRKDIST} ${WRKSRC} ${WRKBUILD}
62 mkdir -p ${WRKDIR} ${WRKDIST}
63 ${MAKE} do-extract
64 @${MAKE} post-extract
65 touch $@
66
67fetch refetch do-extract:
68
69__use_generic_patch_target:=42
70else ifeq ($(strip ${_IN_PACKAGE}),1)
71$(warning This package does not use the generic extraction and patch target; it's most likely to fail.)
72endif
73
74ifeq ($(strip ${__use_generic_patch_target}),42)
75post-patch:
76${WRKDIST}/.prepared: ${WRKDIST}/.extract_done
77 [ ! -d ./patches ] || ${PREVENT_PATCH} ${PATCH} ${WRKDIST} ./patches \
78 '{patch-!(*.orig),*.patch}'
79 [ ! -d ./extra ] || (cd extra; $(PREVENT_PATCH) pax -rw . ${WRKDIST}/)
80 @${MAKE} post-patch
81 touch $@
82endif
83
84update-patches:
85 @test ! -d ${WRKDIR}.orig || rm -rf ${WRKDIR}.orig
86 @test ! -d ${WRKDIR}.orig
87ifeq ($(strip ${_IN_PACKAGE}),1)
88 @$(MAKE) -s V=0 patch WRKDIR=${WRKDIR}.orig PREVENT_PATCH=:
89else
90 @$(MAKE) -s V=0 prepare WRKDIR=${WRKDIR}.orig PREVENT_PATCH=:
91endif
92 @toedit=$$(WRKDIST='${WRKDIST}' CURDIR=$$(pwd) \
93 PATCH_LIST='patch-* *.patch' WRKDIR1='${WRKDIR}' \
94 ${BASH} ${TOPDIR}/scripts/update-patches); \
95 if [[ -n $$toedit && $$toedit != FAIL ]]; then \
96 echo -n 'edit patches: '; read i; \
97 cd patches && $${VISUAL:-$${EDITOR:-/usr/bin/vi}} $$toedit; \
98 fi; \
99 rm -rf ${WRKDIR}.orig; \
100 [[ $$toedit != FAIL ]]
101
102.PHONY: update-patches
Note: See TracBrowser for help on using the repository browser.