Changeset 16227


Ignore:
Timestamp:
2009-05-31T13:35:13+02:00 (7 years ago)
Author:
ralph
Message:

[package] add package source path override

  • use external source tree instead of source ball
  • the external package source tree will be included as symlink
  • make package/<name>/clean will delete the symlink instead of whole source tree
  • usefull in conjunction with external SCM like ClearCase
  • package-version-override.mk has to be included before package.mk
Location:
trunk/include
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/package-version-override.mk

    r9813 r16227  
     1# remember the provided package version 
    12PKG_VERSION_ORGINAL:=$(PKG_VERSION) 
    23 
    3 ifeq ($(CONFIG_$(PKG_NAME)_USE_OTHER_VERSION),y) 
    4 PKG_VERSION:= $(strip $(subst ",, $(CONFIG_$(PKG_NAME)_OTHER_VERSION))) 
     4# in case that another version is provided, overwrite the original 
     5ifeq ($(CONFIG_$(PKG_NAME)_USE_CUSTOM_VERSION),y) 
     6PKG_VERSION:= $(strip $(subst ",, $(CONFIG_$(PKG_NAME)_CUSTOM_VERSION))) 
     7PKG_SOURCE:=$(subst $(PKG_VERSION_ORGINAL),$(PKG_VERSION),$(PKG_SOURCE)) 
    58PKG_MD5SUM:= 
    6 PKG_SOURCE:=$(subst $(PKG_VERSION_ORGINAL),$(PKG_VERSION),$(PKG_SOURCE)) 
    79endif 
    810 
    9 define Package/$(PKG_NAME)/config 
     11# package specific configuration 
     12# if includeded the package version can be overwritten within the .config file (instead of changing the package specific Makefile) 
     13define Package/$(PKG_NAME)/override_version 
    1014        menu "overwrite package version" 
    1115                depends on PACKAGE_$(PKG_NAME) 
    12         config $(PKG_NAME)_USE_OTHER_VERSION 
     16        config $(PKG_NAME)_USE_CUSTOM_VERSION 
    1317                depends on PACKAGE_$(PKG_NAME) 
    14                 bool "Use other source version" 
     18                bool "Use custom package version" 
    1519                default n 
    16         config $(PKG_NAME)_OTHER_VERSION 
    17                 depends on $(PKG_NAME)_USE_OTHER_VERSION 
     20        config $(PKG_NAME)_CUSTOM_VERSION 
     21                depends on $(PKG_NAME)_USE_CUSTOM_VERSION 
    1822                string "$(PKG_BASE_NAME) version as string (default version: $(PKG_VERSION_ORGINAL))" 
    1923                default "$(PKG_VERSION_ORGINAL)" 
    2024        endmenu 
    2125endef 
     26 
     27# in case that an customer source path is provided, set the acc. default variable 
     28ifeq ($(CONFIG_$(PKG_NAME)_USE_CUSTOM_SOURCE_DIR),y) 
     29PKG_DEFAULT_CUSTOM_SOURCE_DIR:= $(strip $(subst ",, $(CONFIG_$(PKG_NAME)_CUSTOM_SOURCE_DIR))) 
     30endif 
     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 
     35define 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 
     47endef 
     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 
     52define Package/$(PKG_NAME)/config 
     53   $(call Package/$(PKG_NAME)/override_version) 
     54   $(call Package/$(PKG_NAME)/override_source_path) 
     55endef 
     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 
     60define 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 
     70endef 
     71 
  • trunk/include/package.mk

    r15453 r16227  
    4747    endef 
    4848  endif 
     49endif 
     50 
     51ifeq ($(CONFIG_$(PKG_NAME)_USE_CUSTOM_SOURCE_DIR),y) 
     52# disable load stage 
     53PKG_SOURCE_URL:= 
     54# add hook to install a link to customer source path of dedicated package 
     55Hooks/Prepare/Pre += prepare_custom_source_directory 
     56# define empty default action 
     57define Build/Prepare/Default 
     58        @:  
     59endef 
    4960endif 
    5061 
Note: See TracChangeset for help on using the changeset viewer.