1# Copyright (c) 2013 The Linux Foundation. All rights reserved. 2# remember the provided package version 3PKG_VERSION_ORGINAL:=$(PKG_VERSION) 4 5# in case that another version is provided, overwrite the original 6ifeq ($(CONFIG_$(PKG_NAME)_USE_CUSTOM_VERSION),y) 7PKG_VERSION:=$(call qstrip,$(CONFIG_$(PKG_NAME)_CUSTOM_VERSION)) 8PKG_SOURCE:=$(subst $(PKG_VERSION_ORGINAL),$(PKG_VERSION),$(PKG_SOURCE)) 9PKG_BUILD_DIR:=$(subst $(PKG_VERSION_ORGINAL),$(PKG_VERSION),$(PKG_BUILD_DIR)) 10PKG_MD5SUM:= 11endif 12 13# package specific configuration 14# if includeded the package version can be overwritten within the .config file (instead of changing the package specific Makefile) 15# $(1): package name 16# $(2): list of selected versions. if missing, will use an input string 17define Package/$(PKG_NAME)/override_version 18 menu "overwrite package version" 19 depends on PACKAGE_$(1) 20 config $(PKG_NAME)_USE_CUSTOM_VERSION 21 depends on PACKAGE_$(1) 22 bool "Use custom package version" 23 default n 24$(if $(2), 25 choice 26 prompt "select version" 27 depends on $(PKG_NAME)_USE_CUSTOM_VERSION 28 $(foreach version,$(2), 29 config $(1)_VERSION_$(version) 30 bool "$(version)") 31 endchoice 32 config $(PKG_NAME)_CUSTOM_VERSION 33 string 34 $(foreach version,$(2), 35 default "$(version)" if $(1)_VERSION_$(version)) 36, 37 config $(PKG_NAME)_CUSTOM_VERSION 38 depends on $(PKG_NAME)_USE_CUSTOM_VERSION 39 string "$(PKG_NAME) version as string (default version: $(PKG_VERSION_ORGINAL))" 40 default "$(PKG_VERSION_ORGINAL)" 41) 42 endmenu 43endef 44 45# in case that an customer source path is provided, set the acc. default variable 46ifeq ($(CONFIG_$(PKG_NAME)_USE_CUSTOM_SOURCE_DIR),y) 47PKG_DEFAULT_CUSTOM_SOURCE_DIR:= $(call qstrip,$(CONFIG_$(PKG_NAME)_CUSTOM_SOURCE_DIR)) 48endif 49 50# package specific configuration 51# if includeded the package source path can be overwritten within the .config file (instead of changing the package specific Makefile) 52# instead of using a source ball (eg tar.gz) the specified path will point to the location of the sources 53define Package/$(PKG_NAME)/override_source_path 54 menu "custom source directory" 55 depends on PACKAGE_$(1) 56 config $(PKG_NAME)_USE_CUSTOM_SOURCE_DIR 57 depends on PACKAGE_$(1) 58 bool "Use custom source directory" 59 default n 60 config $(PKG_NAME)_CUSTOM_SOURCE_DIR 61 depends on $(PKG_NAME)_USE_CUSTOM_SOURCE_DIR 62 string "Custom source directory" 63 default "$(PKG_DEFAULT_CUSTOM_SOURCE_DIR)" 64 endmenu 65endef 66 67# default: 68# include both configurations as long this file is included before package.mk 69# in case that you're defining your own onfiguration within the package Makefile just include the stuff by yourself 70define Package/$(PKG_NAME)/config 71 $(call Package/$(PKG_NAME)/override_version,$(PKG_NAME)) 72 $(call Package/$(PKG_NAME)/override_source_path,$(PKG_NAME)) 73endef 74 75define KernelPackage/$(PKG_NAME)/config 76 $(call Package/$(PKG_NAME)/override_version,kmod-$(PKG_NAME)) 77 $(call Package/$(PKG_NAME)/override_source_path,kmod-$(PKG_NAME)) 78endef 79 80# hook for custom source path 81# in case that the specified path is valid a link to the PKG_SOURCE_DIR is created 82# otherwise the make is stopped 83define prepare_custom_source_directory 84 if [ -d $(CONFIG_$(PKG_NAME)_CUSTOM_SOURCE_DIR) ]; then \ 85 rm -Rf $(PKG_BUILD_DIR); \ 86 echo "Preparing Custom Source Directory link: $(CONFIG_$(PKG_NAME)_CUSTOM_SOURCE_DIR)"; \ 87 ln -snf $(CONFIG_$(PKG_NAME)_CUSTOM_SOURCE_DIR) $(PKG_BUILD_DIR); \ 88 else \ 89 echo "Custom Source Directory $(CONFIG_$(PKG_NAME)_CUSTOM_SOURCE_DIR) is invalid"; \ 90 false; \ 91 fi 92endef 93 94