version.mk 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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_HOME_URL \
  13. CONFIG_VERSION_BUG_URL \
  14. CONFIG_VERSION_NUMBER \
  15. CONFIG_VERSION_CODE \
  16. CONFIG_VERSION_REPO \
  17. CONFIG_VERSION_DIST \
  18. CONFIG_VERSION_MANUFACTURER \
  19. CONFIG_VERSION_MANUFACTURER_URL \
  20. CONFIG_VERSION_PRODUCT \
  21. CONFIG_VERSION_SUPPORT_URL \
  22. CONFIG_VERSION_HWREV \
  23. sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1))))
  24. VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER))
  25. VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),v1.5.1)
  26. VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE))
  27. VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION))
  28. VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO))
  29. VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://librecmc.org/librecmc/downloads/snapshots/%v)
  30. VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST))
  31. VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),libreCMC)
  32. VERSION_DIST_SANITIZED:=$(call sanitize,$(VERSION_DIST))
  33. VERSION_MANUFACTURER:=$(call qstrip,$(CONFIG_VERSION_MANUFACTURER))
  34. VERSION_MANUFACTURER:=$(if $(VERSION_MANUFACTURER),$(VERSION_MANUFACTURER),libreCMC)
  35. VERSION_MANUFACTURER_URL:=$(call qstrip,$(CONFIG_VERSION_MANUFACTURER_URL))
  36. VERSION_MANUFACTURER_URL:=$(if $(VERSION_MANUFACTURER_URL),$(VERSION_MANUFACTURER_URL),https://librecmc.org/)
  37. VERSION_BUG_URL:=$(call qstrip,$(CONFIG_VERSION_BUG_URL))
  38. VERSION_BUG_URL:=$(if $(VERSION_BUG_URL),$(VERSION_BUG_URL),https://gogs.librecmc.org/libreCMC/libreCMC/issues)
  39. VERSION_HOME_URL:=$(call qstrip,$(CONFIG_VERSION_HOME_URL))
  40. VERSION_HOME_URL:=$(if $(VERSION_HOME_URL),$(VERSION_HOME_URL),https://librecmc.org/)
  41. VERSION_SUPPORT_URL:=$(call qstrip,$(CONFIG_VERSION_SUPPORT_URL))
  42. VERSION_SUPPORT_URL:=$(if $(VERSION_SUPPORT_URL),$(VERSION_SUPPORT_URL))
  43. VERSION_PRODUCT:=$(call qstrip,$(CONFIG_VERSION_PRODUCT))
  44. VERSION_PRODUCT:=$(if $(VERSION_PRODUCT),$(VERSION_PRODUCT),Generic)
  45. VERSION_HWREV:=$(call qstrip,$(CONFIG_VERSION_HWREV))
  46. VERSION_HWREV:=$(if $(VERSION_HWREV),$(VERSION_HWREV),v0)
  47. define taint2sym
  48. $(CONFIG_$(firstword $(subst :, ,$(subst +,,$(subst -,,$(1))))))
  49. endef
  50. define taint2name
  51. $(lastword $(subst :, ,$(1)))
  52. endef
  53. VERSION_TAINT_SPECS := \
  54. -ALL_KMODS:no-all \
  55. -IPV6:no-ipv6 \
  56. +USE_GLIBC:glibc \
  57. +USE_MKLIBS:mklibs \
  58. +BUSYBOX_CUSTOM:busybox \
  59. +OVERRIDE_PKGS:override \
  60. VERSION_TAINTS := $(strip $(foreach taint,$(VERSION_TAINT_SPECS), \
  61. $(if $(findstring +,$(taint)), \
  62. $(if $(call taint2sym,$(taint)),$(call taint2name,$(taint))), \
  63. $(if $(call taint2sym,$(taint)),,$(call taint2name,$(taint))) \
  64. )))
  65. PKG_CONFIG_DEPENDS += $(foreach taint,$(VERSION_TAINT_SPECS),$(call taint2sym,$(taint)))
  66. # escape commas, backslashes, squotes, and ampersands for sed
  67. define sed_escape
  68. $(subst &,\&,$(subst $(comma),\$(comma),$(subst ','\'',$(subst \,\\,$(1)))))
  69. endef
  70. #'
  71. VERSION_SED_SCRIPT:=$(SED) 's,%U,$(call sed_escape,$(VERSION_REPO)),g' \
  72. -e 's,%V,$(call sed_escape,$(VERSION_NUMBER)),g' \
  73. -e 's,%v,\L$(call sed_escape,$(subst $(space),_,$(VERSION_NUMBER))),g' \
  74. -e 's,%C,$(call sed_escape,$(VERSION_CODE)),g' \
  75. -e 's,%c,\L$(call sed_escape,$(subst $(space),_,$(VERSION_CODE))),g' \
  76. -e 's,%D,$(call sed_escape,$(VERSION_DIST)),g' \
  77. -e 's,%d,\L$(call sed_escape,$(subst $(space),_,$(VERSION_DIST))),g' \
  78. -e 's,%R,$(call sed_escape,$(REVISION)),g' \
  79. -e 's,%T,$(call sed_escape,$(BOARD)),g' \
  80. -e 's,%S,$(call sed_escape,$(BOARD)/$(if $(SUBTARGET),$(SUBTARGET),generic)),g' \
  81. -e 's,%A,$(call sed_escape,$(ARCH_PACKAGES)),g' \
  82. -e 's,%t,$(call sed_escape,$(VERSION_TAINTS)),g' \
  83. -e 's,%M,$(call sed_escape,$(VERSION_MANUFACTURER)),g' \
  84. -e 's,%m,$(call sed_escape,$(VERSION_MANUFACTURER_URL)),g' \
  85. -e 's,%b,$(call sed_escape,$(VERSION_BUG_URL)),g' \
  86. -e 's,%u,$(call sed_escape,$(VERSION_HOME_URL)),g' \
  87. -e 's,%s,$(call sed_escape,$(VERSION_SUPPORT_URL)),g' \
  88. -e 's,%P,$(call sed_escape,$(VERSION_PRODUCT)),g' \
  89. -e 's,%h,$(call sed_escape,$(VERSION_HWREV)),g'