buildhlp.mk 2.8 KB

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