1
0

buildhlp.mk 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. # This file is part of the OpenADK project. OpenADK is copyrighted
  2. # material, please see the LICENCE file in the top-level directory.
  3. ifneq ($(strip ${PKG_SITES}),)
  4. ifeq ($(strip ${DISTFILES}),)
  5. DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.gz
  6. endif
  7. endif
  8. # This is where all package operation is done in
  9. WRKDIR?= ${WRKDIR_BASE}/w-${PKG_NAME}-${PKG_VERSION}-${PKG_RELEASE}
  10. # This is where source code is extracted and patched
  11. WRKDIST?= ${WRKDIR}/${PKG_NAME}-${PKG_VERSION}
  12. # This is where the configure script is seeked (localed)
  13. WRKSRC?= ${WRKDIST}
  14. # This is where configure, make and make install (fake) run from
  15. WRKBUILD?= ${WRKSRC}
  16. # This is where make install (fake) writes to
  17. WRKINST?= ${WRKDIR}/fake-${CPU_ARCH}/root
  18. ifeq ($(strip ${NO_CHECKSUM}),)
  19. _CHECKSUM_COOKIE= ${WRKDIR}/.checksum_done
  20. else
  21. _CHECKSUM_COOKIE=
  22. endif
  23. post-extract:
  24. ifeq ($(strip ${NO_DISTFILES}),1)
  25. ${WRKDIST}/.extract_done:
  26. rm -rf ${WRKDIST} ${WRKSRC} ${WRKBUILD}
  27. @mkdir -p ${WRKDIR} ${WRKDIST}
  28. ${MAKE} do-extract
  29. @${MAKE} post-extract $(MAKE_TRACE)
  30. touch $@
  31. fetch refetch checksum do-extract:
  32. __use_generic_patch_target:=42
  33. else ifneq ($(strip ${DISTFILES}),)
  34. include ${TOPDIR}/mk/fetch.mk
  35. ${WRKDIST}/.extract_done: ${_CHECKSUM_COOKIE}
  36. ifeq (${_CHECKSUM_COOKIE},)
  37. rm -rf ${WRKDIST} ${WRKSRC} ${WRKBUILD}
  38. endif
  39. ifeq ($(EXTRACT_OVERRIDE),1)
  40. ${MAKE} do-extract
  41. else
  42. ${EXTRACT_CMD}
  43. endif
  44. @${MAKE} post-extract $(MAKE_TRACE)
  45. touch $@
  46. __use_generic_patch_target:=42
  47. else
  48. include ${TOPDIR}/mk/fetch.mk
  49. ${WRKDIST}/.extract_done: ${_CHECKSUM_COOKIE}
  50. $(MAKE) fetch
  51. ifeq (${_CHECKSUM_COOKIE},)
  52. rm -rf ${WRKDIST} ${WRKSRC} ${WRKBUILD}
  53. endif
  54. ifeq ($(EXTRACT_OVERRIDE),1)
  55. ${MAKE} do-extract
  56. else
  57. ${EXTRACT_CMD}
  58. endif
  59. @${MAKE} post-extract $(MAKE_TRACE)
  60. touch $@
  61. endif
  62. ifeq ($(strip ${__use_generic_patch_target}),42)
  63. post-patch:
  64. ${WRKDIST}/.prepared: ${WRKDIST}/.extract_done
  65. [ ! -d ./patches/${PKG_VERSION} ] || ${PREVENT_PATCH} ${PATCH} ${WRKDIST} ./patches/${PKG_VERSION} \
  66. '{patch-!(*.orig),*.patch}' $(MAKE_TRACE)
  67. [ ! -d ./patches ] || ${PREVENT_PATCH} ${PATCH} ${WRKDIST} ./patches \
  68. '{patch-!(*.orig),*.patch}' $(MAKE_TRACE)
  69. [ ! -d ./src ] || (cd src; $(PREVENT_PATCH) cp -Rp . ${WRKDIST}/) \
  70. $(MAKE_TRACE)
  71. @${MAKE} post-patch $(MAKE_TRACE)
  72. touch $@
  73. endif
  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. @-test ! -r ${WRKDIR}/.autoreconf_done || \
  83. (wrkdist=$(WRKDIST) dir=$${wrkdist#$(WRKDIR)}; \
  84. cd ${WRKDIR}.orig$${dir}; \
  85. env ${AUTOTOOL_ENV} autoreconf -if; \
  86. rm -rf ${WRKDIR}.orig$${dir}/autom4te.cache ) $(MAKE_TRACE)
  87. @# restore config.sub/config.guess
  88. @for i in $$(find ${WRKDIR} -name config.sub);do \
  89. if [ -f $$i.bak ];then \
  90. mv $$i.bak $$i; \
  91. fi;\
  92. done
  93. @for i in $$(find ${WRKDIR} -name config.guess);do \
  94. if [ -f $$i.bak ];then \
  95. mv $$i.bak $$i; \
  96. fi;\
  97. done
  98. @toedit=$$(WRKDIST='${WRKDIST}' CURDIR=$$(pwd) \
  99. PATCH_LIST='patch-* *.patch' WRKDIR1='${WRKDIR}' \
  100. ${BASH} ${TOPDIR}/scripts/update-patches); \
  101. if [[ -n $$toedit && $$toedit != FAIL ]]; then \
  102. echo -n 'edit patches: '; read i; \
  103. cd patches && $${VISUAL:-$${EDITOR:-vi}} $$toedit; \
  104. fi; \
  105. rm -rf ${WRKDIR}.orig; \
  106. [[ $$toedit != FAIL ]]
  107. .PHONY: update-patches