1
0

version.mk 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. # SPDX-License-Identifier: GPL-2.0-only
  2. #
  3. # Copyright (C) 2012-2015 OpenWrt.org
  4. # Copyright (C) 2016 LEDE Project
  5. # Substituted by SDK, do not remove
  6. # REVISION:=x
  7. # SOURCE_DATE_EPOCH:=x
  8. PKG_CONFIG_DEPENDS += \
  9. CONFIG_VERSION_HOME_URL \
  10. CONFIG_VERSION_BUG_URL \
  11. CONFIG_VERSION_NUMBER \
  12. CONFIG_VERSION_CODE \
  13. CONFIG_VERSION_REPO \
  14. CONFIG_VERSION_DIST \
  15. CONFIG_VERSION_MANUFACTURER \
  16. CONFIG_VERSION_MANUFACTURER_URL \
  17. CONFIG_VERSION_PRODUCT \
  18. CONFIG_VERSION_SUPPORT_URL \
  19. CONFIG_VERSION_HWREV \
  20. sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1))))
  21. VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER))
  22. VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),v6.0)
  23. VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE))
  24. VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION))
  25. VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO))
  26. VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://librecmc.org/librecmc/downloads/snapshots/%v)
  27. VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST))
  28. VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),libreCMC)
  29. VERSION_DIST_SANITIZED:=$(call sanitize,$(VERSION_DIST))
  30. VERSION_MANUFACTURER:=$(call qstrip,$(CONFIG_VERSION_MANUFACTURER))
  31. VERSION_MANUFACTURER:=$(if $(VERSION_MANUFACTURER),$(VERSION_MANUFACTURER),libreCMC)
  32. VERSION_MANUFACTURER_URL:=$(call qstrip,$(CONFIG_VERSION_MANUFACTURER_URL))
  33. VERSION_MANUFACTURER_URL:=$(if $(VERSION_MANUFACTURER_URL),$(VERSION_MANUFACTURER_URL),https://librecmc.org/)
  34. VERSION_BUG_URL:=$(call qstrip,$(CONFIG_VERSION_BUG_URL))
  35. VERSION_BUG_URL:=$(if $(VERSION_BUG_URL),$(VERSION_BUG_URL),https://gogs.librecmc.org/libreCMC/libreCMC/issues)
  36. VERSION_HOME_URL:=$(call qstrip,$(CONFIG_VERSION_HOME_URL))
  37. VERSION_HOME_URL:=$(if $(VERSION_HOME_URL),$(VERSION_HOME_URL),https://librecmc.org/)
  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,%u,$(call sed_escape,$(VERSION_HOME_URL)),g' \
  84. -e 's,%s,$(call sed_escape,$(VERSION_SUPPORT_URL)),g' \
  85. -e 's,%P,$(call sed_escape,$(VERSION_PRODUCT)),g' \
  86. -e 's,%h,$(call sed_escape,$(VERSION_HWREV)),g'