| 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 ${PKG_SOURCE_URL}),)
|
|---|
| 8 | ifeq ($(strip ${PKG_SOURCE}),)
|
|---|
| 9 | PKG_SOURCE:= ${PKG_NAME}-${PKG_VERSION}.tar.gz
|
|---|
| 10 | endif
|
|---|
| 11 | endif
|
|---|
| 12 | ifneq ($(strip ${PKG_SOURCE}),)
|
|---|
| 13 | DISTFILES?= ${DL_DIR}/${PKG_SOURCE}
|
|---|
| 14 | endif
|
|---|
| 15 |
|
|---|
| 16 | # This is where all package operation is done in
|
|---|
| 17 | WRKDIR?= ${WRKDIR_BASE}/w-${PKG_NAME}-${PKG_VERSION}-${PKG_RELEASE}
|
|---|
| 18 | # This is where source code is extracted and patched
|
|---|
| 19 | WRKDIST?= ${WRKDIR}/${PKG_NAME}-${PKG_VERSION}
|
|---|
| 20 | # This is where the configure script is seeked (localed)
|
|---|
| 21 | WRKSRC?= ${WRKDIST}
|
|---|
| 22 | # This is where configure, make and make install (fake) run from
|
|---|
| 23 | WRKBUILD?= ${WRKSRC}
|
|---|
| 24 | # This is where make install (fake) writes to
|
|---|
| 25 | WRKINST?= ${WRKDIR}/fake-${ARCH}/root
|
|---|
| 26 |
|
|---|
| 27 | ifneq ($(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}
|
|---|
| 33 | endif
|
|---|
| 34 |
|
|---|
| 35 | post-extract:
|
|---|
| 36 |
|
|---|
| 37 | # no, this is not a failure
|
|---|
| 38 | checksum:
|
|---|
| 39 | @echo "There is currently no way to checksum the" >&2
|
|---|
| 40 | @echo "distfiles downloaded in FreeWRT. Sorry." >&2
|
|---|
| 41 |
|
|---|
| 42 | ifneq ($(strip ${DISTFILES})$(strip ${PKG_SOURCE}),)
|
|---|
| 43 | fetch: ${DISTFILES}
|
|---|
| 44 | refetch:
|
|---|
| 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}
|
|---|
| 52 | ifneq ($(strip ${CRLF_WORKAROUND}),)
|
|---|
| 53 | perl -pi -e 's!\r$$!!g' $$(find ${WRKDIST} -type f)
|
|---|
| 54 | endif
|
|---|
| 55 | @${MAKE} post-extract
|
|---|
| 56 | touch $@
|
|---|
| 57 |
|
|---|
| 58 | __use_generic_patch_target:=42
|
|---|
| 59 | else 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 |
|
|---|
| 67 | fetch refetch do-extract:
|
|---|
| 68 |
|
|---|
| 69 | __use_generic_patch_target:=42
|
|---|
| 70 | else ifeq ($(strip ${_IN_PACKAGE}),1)
|
|---|
| 71 | $(warning This package does not use the generic extraction and patch target; it's most likely to fail.)
|
|---|
| 72 | endif
|
|---|
| 73 |
|
|---|
| 74 | ifeq ($(strip ${__use_generic_patch_target}),42)
|
|---|
| 75 | post-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 $@
|
|---|
| 82 | endif
|
|---|
| 83 |
|
|---|
| 84 | update-patches:
|
|---|
| 85 | @test ! -d ${WRKDIR}.orig || rm -rf ${WRKDIR}.orig
|
|---|
| 86 | @test ! -d ${WRKDIR}.orig
|
|---|
| 87 | ifeq ($(strip ${_IN_PACKAGE}),1)
|
|---|
| 88 | @$(MAKE) -s V=0 patch WRKDIR=${WRKDIR}.orig PREVENT_PATCH=:
|
|---|
| 89 | else
|
|---|
| 90 | @$(MAKE) -s V=0 prepare WRKDIR=${WRKDIR}.orig PREVENT_PATCH=:
|
|---|
| 91 | endif
|
|---|
| 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
|
|---|