version.mk 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #
  2. # Copyright (C) 2012-2015 OpenWrt.org
  3. # Copyright (C) 2016 LEDE Project
  4. #
  5. # This is free software, licensed under the GNU General Public License v2.
  6. # See /LICENSE for more information.
  7. #
  8. # Substituted by SDK, do not remove
  9. # REVISION:=x
  10. # SOURCE_DATE_EPOCH:=x
  11. PKG_CONFIG_DEPENDS += \
  12. CONFIG_VERSION_BUG_URL \
  13. CONFIG_VERSION_NUMBER \
  14. CONFIG_VERSION_CODE \
  15. CONFIG_VERSION_REPO \
  16. CONFIG_VERSION_DIST \
  17. CONFIG_VERSION_MANUFACTURER \
  18. CONFIG_VERSION_MANUFACTURER_URL \
  19. CONFIG_VERSION_PRODUCT \
  20. CONFIG_VERSION_SUPPORT_URL \
  21. CONFIG_VERSION_HWREV \
  22. sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1))))
  23. VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER))
  24. VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),v1.5)
  25. VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE))
  26. VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION))
  27. VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO))
  28. VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://librecmc.org/librecmc/downloads/snapshots/%v)
  29. VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST))
  30. VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),libreCMC)
  31. VERSION_DIST_SANITIZED:=$(call sanitize,$(VERSION_DIST))
  32. VERSION_MANUFACTURER:=$(call qstrip,$(CONFIG_VERSION_MANUFACTURER))
  33. VERSION_MANUFACTURER:=$(if $(VERSION_MANUFACTURER),$(VERSION_MANUFACTURER),libreCMC)
  34. VERSION_MANUFACTURER_URL:=$(call qstrip,$(CONFIG_VERSION_MANUFACTURER_URL))
  35. VERSION_MANUFACTURER_URL:=$(if $(VERSION_MANUFACTURER_URL),$(VERSION_MANUFACTURER_URL),https://librecmc.org/)
  36. VERSION_BUG_URL:=$(call qstrip,$(CONFIG_VERSION_BUG_URL))
  37. VERSION_BUG_URL:=$(if $(VERSION_BUG_URL),$(VERSION_BUG_URL),https://gogs.librecmc.org/libreCMC/libreCMC/issues)
  38. VERSION_SUPPORT_URL:=$(call qstrip,$(CONFIG_VERSION_SUPPORT_URL))
  39. VERSION_SUPPORT_URL:=$(if $(VERSION_SUPPORT_URL),$(VERSION_SUPPORT_URL))
  40. VERSION_PRODUCT:=$(call qstrip,$(CONFIG_VERSION_PRODUCT))
  41. VERSION_PRODUCT:=$(if $(VERSION_PRODUCT),$(VERSION_PRODUCT),Generic)
  42. VERSION_HWREV:=$(call qstrip,$(CONFIG_VERSION_HWREV))
  43. VERSION_HWREV:=$(if $(VERSION_HWREV),$(VERSION_HWREV),v0)
  44. define taint2sym
  45. $(CONFIG_$(firstword $(subst :, ,$(subst +,,$(subst -,,$(1))))))
  46. endef
  47. define taint2name
  48. $(lastword $(subst :, ,$(1)))
  49. endef
  50. VERSION_TAINT_SPECS := \
  51. -ALL_KMODS:no-all \
  52. -IPV6:no-ipv6 \
  53. +USE_GLIBC:glibc \
  54. +USE_MKLIBS:mklibs \
  55. +BUSYBOX_CUSTOM:busybox \
  56. +OVERRIDE_PKGS:override \
  57. VERSION_TAINTS := $(strip $(foreach taint,$(VERSION_TAINT_SPECS), \
  58. $(if $(findstring +,$(taint)), \
  59. $(if $(call taint2sym,$(taint)),$(call taint2name,$(taint))), \
  60. $(if $(call taint2sym,$(taint)),,$(call taint2name,$(taint))) \
  61. )))
  62. PKG_CONFIG_DEPENDS += $(foreach taint,$(VERSION_TAINT_SPECS),$(call taint2sym,$(taint)))
  63. # escape commas, backslashes, squotes, and ampersands for sed
  64. define sed_escape
  65. $(subst &,\&,$(subst $(comma),\$(comma),$(subst ','\'',$(subst \,\\,$(1)))))
  66. endef
  67. #'
  68. VERSION_SED_SCRIPT:=$(SED) 's,%U,$(call sed_escape,$(VERSION_REPO)),g' \
  69. -e 's,%V,$(call sed_escape,$(VERSION_NUMBER)),g' \
  70. -e 's,%v,\L$(call sed_escape,$(subst $(space),_,$(VERSION_NUMBER))),g' \
  71. -e 's,%C,$(call sed_escape,$(VERSION_CODE)),g' \
  72. -e 's,%c,\L$(call sed_escape,$(subst $(space),_,$(VERSION_CODE))),g' \
  73. -e 's,%D,$(call sed_escape,$(VERSION_DIST)),g' \
  74. -e 's,%d,\L$(call sed_escape,$(subst $(space),_,$(VERSION_DIST))),g' \
  75. -e 's,%R,$(call sed_escape,$(REVISION)),g' \
  76. -e 's,%T,$(call sed_escape,$(BOARD)),g' \
  77. -e 's,%S,$(call sed_escape,$(BOARD)/$(if $(SUBTARGET),$(SUBTARGET),generic)),g' \
  78. -e 's,%A,$(call sed_escape,$(ARCH_PACKAGES)),g' \
  79. -e 's,%t,$(call sed_escape,$(VERSION_TAINTS)),g' \
  80. -e 's,%M,$(call sed_escape,$(VERSION_MANUFACTURER)),g' \
  81. -e 's,%m,$(call sed_escape,$(VERSION_MANUFACTURER_URL)),g' \
  82. -e 's,%b,$(call sed_escape,$(VERSION_BUG_URL)),g' \
  83. -e 's,%s,$(call sed_escape,$(VERSION_SUPPORT_URL)),g' \
  84. -e 's,%P,$(call sed_escape,$(VERSION_PRODUCT)),g' \
  85. -e 's,%h,$(call sed_escape,$(VERSION_HWREV)),g'