Changeset 9057


Ignore:
Timestamp:
2007-09-29T02:05:48+02:00 (9 years ago)
Author:
nbd
Message:

Refactor downloading code into download.mk
Support multiple file downloads
Support svn downloads

Location:
trunk
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/host-build.mk

    r8879 r9057  
    2020override MAKEFLAGS= 
    2121 
     22include $(INCLUDE_DIR)/download.mk 
    2223include $(INCLUDE_DIR)/quilt.mk 
    2324 
     
    7071endef 
    7172 
    72                  
    73 ifneq ($(strip $(PKG_SOURCE)),) 
    74   download: $(DL_DIR)/$(PKG_SOURCE) 
    75  
    76   $(DL_DIR)/$(PKG_SOURCE): 
    77         mkdir -p $(DL_DIR) 
    78         $(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(PKG_SOURCE)" "$(PKG_MD5SUM)" $(PKG_SOURCE_URL) 
    79  
    80   $(STAMP_PREPARED): $(DL_DIR)/$(PKG_SOURCE) 
    81 endif 
    82  
    8373ifneq ($(if $(QUILT),,$(CONFIG_AUTOREBUILD)),) 
    8474  define HostBuild/Autoclean 
     
    8878endif 
    8979 
     80define Download/default 
     81  FILE:=$(PKG_SOURCE) 
     82  URL:=$(PKG_SOURCE_URL) 
     83  PROTO:=$(PKG_SOURCE_PROTO) 
     84  VERSION:=$(PKG_SOURCE_VERSION) 
     85  MD5SUM:=$(PKG_MD5SUM) 
     86endef 
     87 
    9088define HostBuild 
    91   ifeq ($(DUMP),) 
    92     $(call HostBuild/Autoclean) 
    93   endif 
     89  $(if $(strip $(PKG_SOURCE_URL)),$(call Download,default)) 
     90  $(if $(DUMP),,$(call HostBuild/Autoclean)) 
    9491   
    9592  $(STAMP_PREPARED): 
  • trunk/include/kernel-build.mk

    r8737 r9057  
    1818STAMP_PREPARED:=$(LINUX_DIR)/.prepared 
    1919STAMP_CONFIGURED:=$(LINUX_DIR)/.configured 
     20include $(INCLUDE_DIR)/download.mk 
    2021include $(INCLUDE_DIR)/quilt.mk 
    2122include $(INCLUDE_DIR)/kernel-defaults.mk 
     
    4142endef 
    4243 
     44define Download/kernel 
     45  URL:=$(LINUX_SITE) 
     46  FILE:=$(LINUX_SOURCE) 
     47  MD5SUM:=$(LINUX_KERNEL_MD5SUM) 
     48endef 
     49 
    4350define BuildKernel 
    44   ifneq ($(LINUX_SITE),) 
    45     $(DL_DIR)/$(LINUX_SOURCE): 
    46                 -mkdir -p $(DL_DIR) 
    47                 $(SCRIPT_DIR)/download.pl $(DL_DIR) $(LINUX_SOURCE) $(LINUX_KERNEL_MD5SUM) $(LINUX_SITE) 
    48   endif 
     51  $(if $(LINUX_SITE),$(call Download,kernel)) 
    4952 
    5053  $(STAMP_PREPARED): $(DL_DIR)/$(LINUX_SOURCE) 
  • trunk/include/package.mk

    r9052 r9057  
    2121STAMP_BUILT:=$(PKG_BUILD_DIR)/.built 
    2222 
     23include $(INCLUDE_DIR)/download.mk 
    2324include $(INCLUDE_DIR)/quilt.mk 
    2425include $(INCLUDE_DIR)/package-defaults.mk 
     
    3940endif 
    4041 
     42define Download/default 
     43  FILE:=$(PKG_SOURCE) 
     44  URL:=$(PKG_SOURCE_URL) 
     45  PROTO:=$(PKG_SOURCE_PROTO) 
     46  VERSION:=$(PKG_SOURCE_VERSION) 
     47  MD5SUM:=$(PKG_MD5SUM) 
     48endef 
    4149 
    4250define Build/DefaultTargets 
    43   ifneq ($(strip $(PKG_SOURCE_URL)),) 
    44     download: $(DL_DIR)/$(PKG_SOURCE) 
    45  
    46     $(DL_DIR)/$(PKG_SOURCE): 
    47         mkdir -p $(DL_DIR) 
    48         $(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(PKG_SOURCE)" "$(PKG_MD5SUM)" $(PKG_SOURCE_URL) 
    49  
    50     $(STAMP_PREPARED): $(DL_DIR)/$(PKG_SOURCE) 
    51   endif 
    52  
     51  $(if $(strip $(PKG_SOURCE_URL)),$(call Download,default)) 
    5352  $(call Build/Autoclean) 
    5453 
  • trunk/include/unpack.mk

    r7096 r9057  
    1 ext=$(word $(words $(subst ., ,$(1))),$(subst ., ,$(1))) 
     1#  
     2# Copyright (C) 2006-2007 OpenWrt.org 
     3# 
     4# This is free software, licensed under the GNU General Public License v2. 
     5# See /LICENSE for more information. 
     6# 
    27 
    38# unpacking files with +s may break on some platforms. this typically emits error code 2 
  • trunk/rules.mk

    r8694 r9057  
    11#  
    2 # Copyright (C) 2006 OpenWrt.org 
     2# Copyright (C) 2006-2007 OpenWrt.org 
    33# 
    44# This is free software, licensed under the GNU General Public License v2. 
     
    133133endef 
    134134 
     135# file extension 
     136ext=$(word $(words $(subst ., ,$(1))),$(subst ., ,$(1))) 
     137 
    135138all: 
    136139FORCE: ; 
  • trunk/scripts/download.pl

    r8495 r9057  
    1111use File::Basename; 
    1212 
     13@ARGV > 2 or die "Syntax: $0 <target dir> <filename> <md5sum> [<mirror> ...]\n"; 
     14 
    1315my $target = shift @ARGV; 
    1416my $filename = shift @ARGV; 
     
    1618my $scriptdir = dirname($0); 
    1719my @mirrors; 
    18  
    1920my $ok; 
    20  
    21 @ARGV > 0 or die "Syntax: $0 <target dir> <filename> <md5sum> <mirror> [<mirror> ...]\n"; 
    2221 
    2322sub localmirrors { 
Note: See TracChangeset for help on using the changeset viewer.