version.mk 3.8 KB

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