ar71xx: merge DSA switch patch
[openwrt.git] / include / package-version-override.mk
1 # remember the provided package version
2 PKG_VERSION_ORGINAL:=$(PKG_VERSION)
3
4 # in case that another version is provided, overwrite the original
5 ifeq ($(CONFIG_$(PKG_NAME)_USE_CUSTOM_VERSION),y)
6 PKG_VERSION:= $(strip $(subst ",, $(CONFIG_$(PKG_NAME)_CUSTOM_VERSION)))
7 PKG_SOURCE:=$(subst $(PKG_VERSION_ORGINAL),$(PKG_VERSION),$(PKG_SOURCE))
8 PKG_MD5SUM:=
9 endif
10
11 # package specific configuration
12 # if includeded the package version can be overwritten within the .config file (instead of changing the package specific Makefile)
13 define Package/$(PKG_NAME)/override_version
14 menu "overwrite package version"
15 depends on PACKAGE_$(PKG_NAME)
16 config $(PKG_NAME)_USE_CUSTOM_VERSION
17 depends on PACKAGE_$(PKG_NAME)
18 bool "Use custom package version"
19 default n
20 config $(PKG_NAME)_CUSTOM_VERSION
21 depends on $(PKG_NAME)_USE_CUSTOM_VERSION
22 string "$(PKG_BASE_NAME) version as string (default version: $(PKG_VERSION_ORGINAL))"
23 default "$(PKG_VERSION_ORGINAL)"
24 endmenu
25 endef
26
27 # in case that an customer source path is provided, set the acc. default variable
28 ifeq ($(CONFIG_$(PKG_NAME)_USE_CUSTOM_SOURCE_DIR),y)
29 PKG_DEFAULT_CUSTOM_SOURCE_DIR:= $(strip $(subst ",, $(CONFIG_$(PKG_NAME)_CUSTOM_SOURCE_DIR)))
30 endif
31
32 # package specific configuration
33 # if includeded the package source path can be overwritten within the .config file (instead of changing the package specific Makefile)
34 # instead of using a source ball (eg tar.gz) the specified path will point to the location of the sources
35 define Package/$(PKG_NAME)/override_source_path
36 menu "custom source directory"
37 depends on PACKAGE_$(PKG_NAME)
38 config $(PKG_NAME)_USE_CUSTOM_SOURCE_DIR
39 depends on PACKAGE_$(PKG_NAME)
40 bool "Use custom source directory"
41 default n
42 config $(PKG_NAME)_CUSTOM_SOURCE_DIR
43 depends on $(PKG_NAME)_USE_CUSTOM_SOURCE_DIR
44 string "Custom source directory"
45 default "$(PKG_DEFAULT_CUSTOM_SOURCE_DIR)"
46 endmenu
47 endef
48
49 # default:
50 # include both configurations as long this file is included before package.mk
51 # in case that you're defining your own onfiguration within the package Makefile just include the stuff by yourself
52 define Package/$(PKG_NAME)/config
53 $(call Package/$(PKG_NAME)/override_version)
54 $(call Package/$(PKG_NAME)/override_source_path)
55 endef
56
57 # hook for custom source path
58 # in case that the specified path is valid a link to the PKG_SOURCE_DIR is created
59 # otherwise the make is stopped
60 define prepare_custom_source_directory
61 if [ -d $(CONFIG_$(PKG_NAME)_CUSTOM_SOURCE_DIR) ]; then \
62 rm -Rf $(PKG_BUILD_DIR); \
63 echo "Preparing Custom Source Directory link: $(CONFIG_$(PKG_NAME)_CUSTOM_SOURCE_DIR)"; \
64 ln -snf $(CONFIG_$(PKG_NAME)_CUSTOM_SOURCE_DIR) $(PKG_BUILD_DIR); \
65 ( cd $(PKG_BUILD_DIR); autoreconf -i; ) \
66 else \
67 echo "Custom Source Directory $(CONFIG_$(PKG_NAME)_CUSTOM_SOURCE_DIR) is invalid"; \
68 false; \
69 fi
70 endef
71
This page took 0.043217 seconds and 5 git commands to generate.