1
0

buildhlp.mk 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. ${PACKAGE_DIR}/.stamps:
  24. @mkdir -p ${PACKAGE_DIR}/.stamps
  25. post-extract: ${PACKAGE_DIR}/.stamps
  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 $(MAKE_TRACE)
  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. ifeq ($(EXTRACT_OVERRIDE),1)
  42. ${MAKE} do-extract
  43. else
  44. ${EXTRACT_CMD}
  45. endif
  46. @${MAKE} post-extract $(MAKE_TRACE)
  47. touch $@
  48. __use_generic_patch_target:=42
  49. else
  50. include ${TOPDIR}/mk/fetch.mk
  51. ${WRKDIST}/.extract_done: ${_CHECKSUM_COOKIE}
  52. $(MAKE) fetch
  53. ifeq (${_CHECKSUM_COOKIE},)
  54. rm -rf ${WRKDIST} ${WRKSRC} ${WRKBUILD}
  55. endif
  56. ifeq ($(EXTRACT_OVERRIDE),1)
  57. ${MAKE} do-extract
  58. else
  59. ${EXTRACT_CMD}
  60. endif
  61. @${MAKE} post-extract $(MAKE_TRACE)
  62. touch $@
  63. endif
  64. ifeq ($(strip ${__use_generic_patch_target}),42)
  65. post-patch:
  66. ${WRKDIST}/.prepared: ${WRKDIST}/.extract_done
  67. [ ! -d ./patches/${PKG_VERSION} ] || ${PREVENT_PATCH} ${PATCH} ${WRKDIST} ./patches/${PKG_VERSION} \
  68. '{patch-!(*.orig),*.patch}' $(MAKE_TRACE)
  69. [ ! -d ./patches ] || ${PREVENT_PATCH} ${PATCH} ${WRKDIST} ./patches \
  70. '{patch-!(*.orig),*.patch}' $(MAKE_TRACE)
  71. [ ! -d ./src ] || (cd src; $(PREVENT_PATCH) cp -Rp . ${WRKDIST}/) \
  72. $(MAKE_TRACE)
  73. @${MAKE} post-patch $(MAKE_TRACE)
  74. touch $@
  75. endif
  76. update-patches:
  77. @test ! -d ${WRKDIR}.orig || rm -rf ${WRKDIR}.orig
  78. @test ! -d ${WRKDIR}.orig
  79. ifeq ($(strip ${_IN_PACKAGE})$(strip ${_IN_CVTC}),1)
  80. @$(MAKE) -s V=0 patch WRKDIR=${WRKDIR}.orig PREVENT_PATCH=: NO_CHECKSUM=1
  81. else
  82. @$(MAKE) -s V=0 prepare WRKDIR=${WRKDIR}.orig PREVENT_PATCH=: NO_CHECKSUM=1
  83. endif
  84. @-test ! -r ${WRKDIR}/.autoreconf_done || \
  85. (wrkdist=$(WRKDIST) dir=$${wrkdist#$(WRKDIR)}; \
  86. cd ${WRKDIR}.orig$${dir}; \
  87. env ${AUTOTOOL_ENV} autoreconf -if; \
  88. rm -rf ${WRKDIR}.orig$${dir}/autom4te.cache ) $(MAKE_TRACE)
  89. @# restore config.sub/config.guess
  90. @for i in $$(find ${WRKDIR} -name config.sub);do \
  91. if [ -f $$i.bak ];then \
  92. mv $$i.bak $$i; \
  93. fi;\
  94. done
  95. @for i in $$(find ${WRKDIR} -name config.guess);do \
  96. if [ -f $$i.bak ];then \
  97. mv $$i.bak $$i; \
  98. fi;\
  99. done
  100. @toedit=$$(WRKDIST='${WRKDIST}' CURDIR=$$(pwd) \
  101. PATCH_LIST='patch-* *.patch' WRKDIR1='${WRKDIR}' \
  102. ${BASH} ${TOPDIR}/scripts/update-patches); \
  103. if [[ -n $$toedit && $$toedit != FAIL ]]; then \
  104. echo -n 'edit patches: '; read i; \
  105. cd patches && $${VISUAL:-$${EDITOR:-vi}} $$toedit; \
  106. fi; \
  107. rm -rf ${WRKDIR}.orig; \
  108. [[ $$toedit != FAIL ]]
  109. .PHONY: update-patches