| 1 |
# vim: ft=make ts=4 sw=4 noet |
| 2 |
# |
| 3 |
# $Id: gar.lib.mk 25997 2016-10-22 07:45:48Z cgrzemba $ |
| 4 |
# |
| 5 |
# Copyright (C) 2001 Nick Moffitt |
| 6 |
# |
| 7 |
# Redistribution and/or use, with or without modification, is |
| 8 |
# permitted. This software is without warranty of any kind. The |
| 9 |
# author(s) shall not be liable in the event that use of the |
| 10 |
# software causes damage. |
| 11 |
# |
| 12 |
|
| 13 |
# md5sum ?= md5sum |
| 14 |
md5sum ?= $(if $(filter no%,$(shell which md5sum)),gmd5sum,$(shell which md5sum)) |
| 15 |
# cookies go here, so we have to be able to find them for |
| 16 |
# dependency checking. |
| 17 |
VPATH += $(COOKIEDIR) |
| 18 |
|
| 19 |
# convenience variable to make the cookie. |
| 20 |
MAKECOOKIE = mkdir -p $(COOKIEDIR)/$(@D) && date >> $(COOKIEDIR)/$@ |
| 21 |
|
| 22 |
URLSTRIP = $(subst ://,//,$(1)) |
| 23 |
|
| 24 |
# if you need to proxy git:// connections, set GIT_USE_PROXY. There is a |
| 25 |
# default proxy script that works with the (squid?) proxy at the BO buildfarm. |
| 26 |
# override GIT_PROXY_SCRIPT to something else if you need to. |
| 27 |
GIT_MAYBEPROXY = $(if $(GIT_USE_PROXY),GIT_PROXY_COMMAND=$(GIT_PROXY_SCRIPT)) |
| 28 |
GIT_TREEISH = $(if $(GIT_TREEISH_$(1)),$(GIT_TREEISH_$(1)),HEAD) |
| 29 |
HG_TREEISH = $(if $(HG_TREEISH_$(1)),$(HG_TREEISH_$(1)),tip) |
| 30 |
|
| 31 |
#################### FETCH RULES #################### |
| 32 |
|
| 33 |
# if the caller has defined _postinstall, etc targets for a package, |
| 34 |
# add these 'dynamic script' targets to our fetch list |
| 35 |
_GAR_DYNSCR_URLS := $(foreach DYN,$(DYNSCRIPTS),dynscr://$(DYN)) |
| 36 |
|
| 37 |
$(foreach M,$(MASTER_SITES),$(if $(findstring $(GITHUB_HOST),$(M)),,$(if $(filter %/,$M),,$(error MASTER_SITES must contain only URLs ending in a / wheres this did not: $M)))) |
| 38 |
|
| 39 |
URLS := $(foreach SITE,$(FILE_SITES) $(MASTER_SITES),$(if $(findstring $(GITHUB_HOST),$(SITE)),$(SITE),$(addprefix $(SITE),$(DISTFILES)))) $(foreach SITE,$(FILE_SITES) $(PATCH_SITES) $(MASTER_SITES),$(if $(findstring $(GITHUB_HOST),$(SITE)),$(SITE),$(addprefix $(SITE),$(ALLFILES_PATCHFILES)))) $(_GAR_DYNSCR_URLS) $(DYNURLS) |
| 40 |
|
| 41 |
define gitsubst |
| 42 |
$(subst git-git,git,$(if $(findstring $(1)://,$(2)),$(patsubst $(1)%,git-$(1)%,$(call URLSTRIP,$(2))))) |
| 43 |
endef |
| 44 |
|
| 45 |
ifdef GIT_REPOS |
| 46 |
URLS += $(foreach R,$(GIT_REPOS),gitrepo://$(call GITPROJ,$(R)) $(foreach gitproto,git http file ssh,$(call gitsubst,$(gitproto),$(R)))) |
| 47 |
endif |
| 48 |
|
| 49 |
define hgsubst |
| 50 |
$(subst hg-hg,hg,$(if $(findstring $(1)://,$(2)),$(patsubst $(1)%,hg-$(1)%,$(call URLSTRIP,$(2)) ))) |
| 51 |
endef |
| 52 |
|
| 53 |
ifdef HG_REPOS |
| 54 |
URLS += $(foreach R,$(HG_REPOS),$(foreach hgproto,hg http file ssh,$(call hgsubst,$(hgproto),$(R)))) |
| 55 |
NOEXTRACT += $(call GITPROJ,$(HG_REPOS)).hg |
| 56 |
endif |
| 57 |
|
| 58 |
# filename used for mercurial archive |
| 59 |
GARCHDISTNAME ?= $(DISTNAME).tar.gz |
| 60 |
|
| 61 |
# Download the file if and only if it doesn't have a preexisting |
| 62 |
# checksum file. Loop through available URLs and stop when you |
| 63 |
# get one that doesn't return an error code. |
| 64 |
# Note that GAR targets are used to download the URLs, thus: |
| 65 |
# 1) we have to strip the colon from the URLs |
| 66 |
# 2) the download is very costly with bigger Makefiles as they will be |
| 67 |
# re-evaluated for every URL (nested gmake invocation, room for improvement) |
| 68 |
$(DOWNLOADDIR)/%: _FLIST=$(filter %/$*,$(URLS)) $(foreach URL,$(URLS),$(if $(findstring $(GITHUB_HOST),$(URL)),$(URL),)) |
| 69 |
$(DOWNLOADDIR)/%: |
| 70 |
$(if $(_FLIST),,$(error INTERNAL ERROR: The file $* is requested but not in the list of generated URLs)) |
| 71 |
@if test -f $(COOKIEDIR)/checksum-$*; then : ; else \ |
| 72 |
echo " ==> Grabbing $@"; \ |
| 73 |
( for i in $(filter %/$(*:%.hg=%),$(URLS)) $(foreach URL,$(URLS),$(if $(findstring $(GITHUB_HOST),$(URL)),$(URL),)); do \ |
| 74 |
echo " ==> Trying $$i"; \ |
| 75 |
$(MAKE) -s `echo $$i | tr -d :` || continue; \ |
| 76 |
case $$i in \ |
| 77 |
*$(GITHUB_HOST)*) \ |
| 78 |
if [ -n "$(GITHUB_REFERENCE)" ]; then mv $(PARTIALDIR)/$(GITHUB_REFERENCE) $@; else mv $(PARTIALDIR)/$(*:%.hg=%) $(@:%.hg=%); fi ;; \ |
| 79 |
*) \ |
| 80 |
mv $(PARTIALDIR)/$(*:%.hg=%) $(@:%.hg=%) ;; \ |
| 81 |
esac; \ |
| 82 |
break; \ |
| 83 |
done; ) 2>&1 | grep -v '^$(MAKE)'; \ |
| 84 |
if [ -r $(@:%.hg=%) ] || [ $* = $(GARCHDISTNAME) -a ! -z $(HG_REPOS) ]; then : ; else \ |
| 85 |
echo '(!!!) Failed to download $@!' 1>&2; \ |
| 86 |
false; \ |
| 87 |
fi; \ |
| 88 |
fi |
| 89 |
|
| 90 |
gitrepo//%: |
| 91 |
@( if [ -d $(GARCHIVEDIR)/$(call GITPROJ,$*) ]; then \ |
| 92 |
( cd $(GARCHIVEDIR)/$(call GITPROJ,$*); \ |
| 93 |
$(GIT_MAYBEPROXY) git --bare fetch ) && \ |
| 94 |
gln -s $(GARCHIVEDIR)/$(call GITPROJ,$*)/ $(PARTIALDIR)/$(call GITPROJ,$*); \ |
| 95 |
else \ |
| 96 |
false; \ |
| 97 |
fi ) |
| 98 |
|
| 99 |
# the git remote add commands are so that we can later do a fetch |
| 100 |
# to update the code. |
| 101 |
# we possibly proxy the git:// references depending on GIT_USE_PROXY |
| 102 |
git-http//%: |
| 103 |
@git clone --bare http://$* $(PARTIALDIR)/$(call GITPROJ,$*) |
| 104 |
@( cd $(PARTIALDIR)/$(call GITPROJ,$*); \ |
| 105 |
git config remote.origin.fetch $(if $(GIT_REFS_$(call GITPROJ,$*)),$(GIT_REFS_$(call GITPROJ,$*)),$(GIT_DEFAULT_TRACK)); ) |
| 106 |
|
| 107 |
git//%: |
| 108 |
@$(GIT_MAYBEPROXY) git clone --bare git://$* $(PARTIALDIR)/$(call GITPROJ,$*) |
| 109 |
@( cd $(PARTIALDIR)/$(call GITPROJ,$*); \ |
| 110 |
git config remote.origin.fetch $(if $(GIT_REFS_$(call GITPROJ,$*)),$(GIT_REFS_$(call GITPROJ,$*)),$(GIT_DEFAULT_TRACK)); ) |
| 111 |
|
| 112 |
git-file//%: |
| 113 |
@git clone --bare file:///$* $(PARTIALDIR)/$(call GITPROJ,$*) |
| 114 |
@( cd $(PARTIALDIR)/$(call GITPROJ,$*); \ |
| 115 |
git config remote.origin.fetch $(if $(GIT_REFS_$(call GITPROJ,$*)),$(GIT_REFS_$(call GITPROJ,$*)),$(GIT_DEFAULT_TRACK)); ) |
| 116 |
|
| 117 |
git-ssh//%: |
| 118 |
@git clone --bare ssh://$* $(PARTIALDIR)/$(call GITPROJ,$*) |
| 119 |
@( cd $(PARTIALDIR)/$(call GITPROJ,$*); \ |
| 120 |
git config remote.origin.fetch $(if $(GIT_REFS_$(call GITPROJ,$*)),$(GIT_REFS_$(call GITPROJ,$*)),$(GIT_DEFAULT_TRACK)); ) |
| 121 |
|
| 122 |
hg-http//%: |
| 123 |
hg clone http://$* $(PARTIALDIR)/$(call GITPROJ,$*) |
| 124 |
hg-hg//%: |
| 125 |
hg clone hg://$* $(PARTIALDIR)/$(call GITPROJ,$*) |
| 126 |
hg-ssh//%: |
| 127 |
hg clone ssh://$* $(PARTIALDIR)/$(call GITPROJ,$*) |
| 128 |
hg-file//%: |
| 129 |
hg clone file://$* $(PARTIALDIR)/$(call GITPROJ,$*) |
| 130 |
|
| 131 |
# create ADMSCRIPTS 'on the fly' from variables defined by the caller |
| 132 |
# This version is private and should only be called from the non-private |
| 133 |
# version directly below |
| 134 |
_dynscr//%: |
| 135 |
$($(subst .,_,$*)) |
| 136 |
|
| 137 |
dynscr//%: |
| 138 |
$(MAKE) --no-print-directory -n _$@ > $(PARTIALDIR)/$* |
| 139 |
|
| 140 |
# download an http URL (colons omitted) |
| 141 |
http//%: |
| 142 |
@$(WGET) $(WGET_OPTS) -T 30 -c -P $(PARTIALDIR) http://$* |
| 143 |
|
| 144 |
https//%: |
| 145 |
@$(WGET) $(WGET_OPTS) -T 30 -c -P $(PARTIALDIR) https://$* |
| 146 |
|
| 147 |
# download an ftp URL (colons omitted) |
| 148 |
#ftp//%: |
| 149 |
# @wget -T 30 -c --passive-ftp -P $(PARTIALDIR) ftp://$* |
| 150 |
ftp//%: |
| 151 |
@$(WGET) $(WGET_OPTS) -T 30 -c -P $(PARTIALDIR) ftp://$* |
| 152 |
|
| 153 |
# link to a local copy of the file |
| 154 |
# (absolute path) |
| 155 |
file///%: |
| 156 |
@if test -f /$*; then \ |
| 157 |
gln -sf /$* $(PARTIALDIR)/$(notdir $*); \ |
| 158 |
else \ |
| 159 |
false; \ |
| 160 |
fi |
| 161 |
|
| 162 |
# link to a local copy of the file |
| 163 |
# (relative path) |
| 164 |
file//%: |
| 165 |
@if test -f $*; then \ |
| 166 |
gln -sf "$(CURDIR)/$*" $(PARTIALDIR)/$(notdir $*); \ |
| 167 |
else \ |
| 168 |
false; \ |
| 169 |
fi |
| 170 |
|
| 171 |
# Using Jeff Waugh's rsync rule. |
| 172 |
# DOES NOT PRESERVE SYMLINKS! |
| 173 |
rsync//%: |
| 174 |
@rsync -azvLP rsync://$* $(PARTIALDIR)/ |
| 175 |
|
| 176 |
# Using Jeff Waugh's scp rule |
| 177 |
scp//%: |
| 178 |
@scp -C $* $(PARTIALDIR)/ |
| 179 |
|
| 180 |
# Fetch a SVN repo via http |
| 181 |
svn-http//%: |
| 182 |
@svn co $(SVNHTTP_CO_ARGS) http://$* $(PARTIALDIR)/$(notdir $*) |
| 183 |
|
| 184 |
svn-https//%: |
| 185 |
@svn co $(SVNHTTP_CO_ARGS) https://$* $(PARTIALDIR)/$(notdir $*) |
| 186 |
|
| 187 |
# Sometimes files must be downloaded manually (e.g. for license reasons) |
| 188 |
manual//%: |
| 189 |
@echo |
| 190 |
@echo "Please download the file" |
| 191 |
@echo " $*" |
| 192 |
@echo "manually from" |
| 193 |
@echo " $(SPKG_SOURCEURL)" |
| 194 |
@echo "and copy it to" |
| 195 |
@echo " $(GARCHIVEDIR)" |
| 196 |
@echo |
| 197 |
|
| 198 |
|
| 199 |
#################### CHECKSUM RULES #################### |
| 200 |
|
| 201 |
# check a given file's checksum against $(CHECKSUM_FILE) and |
| 202 |
# error out if it mentions the file without an "OK". |
| 203 |
# The removal of the download prefix is for legacy checksums. For newstyle |
| 204 |
# checksums without path this is not necessary. |
| 205 |
checksum-%: $(CHECKSUM_FILE) |
| 206 |
@echo " ==> Running checksum on $*" |
| 207 |
@if ggrep -- '[ /]$*$$' $(CHECKSUM_FILE); then \ |
| 208 |
if cat $(CHECKSUM_FILE) | sed -e 's!download/!!' | (cd $(DOWNLOADDIR); LC_ALL="C" LANG="C" $(md5sum) -c 2>&1) | \ |
| 209 |
ggrep -- '$*' | ggrep -v ':[ ]\+OK'; then \ |
| 210 |
echo '(!!!) $* failed checksum test!' 1>&2; \ |
| 211 |
false; \ |
| 212 |
else \ |
| 213 |
echo 'file $* passes checksum test!'; \ |
| 214 |
$(MAKECOOKIE); \ |
| 215 |
fi \ |
| 216 |
else \ |
| 217 |
echo '(!!!) $* not in $(CHECKSUM_FILE) file!' 1>&2; \ |
| 218 |
echo '(!!!) Maybe you need to run mgar makesum?' 1>&2; \ |
| 219 |
echo '(!!!) WARNING: This could also mean that you have downloaded broken or compromised archive' 1>&2; \ |
| 220 |
echo '(!!!) [Not likely but possible.]' 1>&2; \ |
| 221 |
false; \ |
| 222 |
fi |
| 223 |
|
| 224 |
#################### CHECKNEW RULES #################### |
| 225 |
|
| 226 |
|
| 227 |
################### UWATCH VARIABLES ################### |
| 228 |
UPSTREAM_MASTER_SITES ?= $(MASTER_SITES) |
| 229 |
ENABLE_UWATCH ?= 1 |
| 230 |
|
| 231 |
|
| 232 |
######################################################## |
| 233 |
# Display uwatch informations |
| 234 |
# |
| 235 |
get-uwatch-configuration: |
| 236 |
@if [ '$(ENABLE_UWATCH)' -ne '1' ] ; then \ |
| 237 |
echo "$(NAME) - Upstream Watch is disabled" ; \ |
| 238 |
else \ |
| 239 |
echo "$(NAME) - Upstream Watch is enabled" ; \ |
| 240 |
if [ ! -n '$(CATALOGNAME)' ]; then \ |
| 241 |
echo "$(NAME) - CATALOGNAME is not set" ; \ |
| 242 |
else \ |
| 243 |
echo "$(NAME) - CATALOGNAME is : $(CATALOGNAME)" ; \ |
| 244 |
fi ; \ |
| 245 |
if [ ! -n '$(DISTFILES)' ]; then \ |
| 246 |
echo "$(NAME) - DISTFILES is not set" ; \ |
| 247 |
else \ |
| 248 |
echo "$(NAME) - DISTFILES are : $(DISTFILES)" ; \ |
| 249 |
fi ; \ |
| 250 |
if [ ! -n '$(UFILES_REGEX)' ]; then \ |
| 251 |
echo "$(NAME) - UFILES_REGEX is not set" ; \ |
| 252 |
else \ |
| 253 |
echo "$(NAME) - UFILES_REGEX is : $(UFILES_REGEX)" ; \ |
| 254 |
fi; \ |
| 255 |
if [ ! -n '$(UPSTREAM_MASTER_SITES)' ]; then \ |
| 256 |
echo "$(NAME) - UPSTREAM_MASTER_SITES is not set" ; \ |
| 257 |
else \ |
| 258 |
echo "$(NAME) - UPSTREAM_MASTER_SITES is : $(UPSTREAM_MASTER_SITES)" ; \ |
| 259 |
fi; \ |
| 260 |
if [ ! -n '$(VERSION)' ]; then \ |
| 261 |
echo "$(NAME) - VERSION is not set" ; \ |
| 262 |
else \ |
| 263 |
echo "$(NAME) - GAR version is : $(VERSION)" ; \ |
| 264 |
fi ; \ |
| 265 |
if [ ! -n '$(http_proxy)' ]; then \ |
| 266 |
echo "$(NAME) - http_proxy is not set" ; \ |
| 267 |
else \ |
| 268 |
echo "$(NAME) - http_proxy is : $(http_proxy)" ; \ |
| 269 |
fi ; \ |
| 270 |
if [ ! -n '$(ftp_proxy)' ]; then \ |
| 271 |
echo "$(NAME) - ftp_proxy is not set" ; \ |
| 272 |
else \ |
| 273 |
echo "$(NAME) - ftp_proxy is : $(ftp_proxy)" ; \ |
| 274 |
fi ; \ |
| 275 |
fi ; |
| 276 |
|
| 277 |
######################################################## |
| 278 |
# Retrieve the list of upstream versions |
| 279 |
# |
| 280 |
|
| 281 |
get-upstream-version-list: |
| 282 |
@if [ '$(ENABLE_UWATCH)' -ne '1' ] ; then \ |
| 283 |
echo "$(NAME) - Upstream Watch is disabled" ; \ |
| 284 |
else \ |
| 285 |
UWATCHCONFCHECK="Ok" ; \ |
| 286 |
if [ ! -n '$(UFILES_REGEX)' ]; then \ |
| 287 |
echo "$(NAME) - UFILES_REGEX is not set - trying to guess it" ; \ |
| 288 |
fi; \ |
| 289 |
if [ ! -n '$(UPSTREAM_MASTER_SITES)' ]; then \ |
| 290 |
echo "$(NAME) - Error UPSTREAM_MASTER_SITES is not set" ; \ |
| 291 |
UWATCHCONFCHECK="Error" ; \ |
| 292 |
fi; \ |
| 293 |
if [ ! -n '$(VERSION)' ]; then \ |
| 294 |
echo "$(NAME) - Error VERSION is not set" ; \ |
| 295 |
UWATCHCONFCHECK="Error" ; \ |
| 296 |
fi; \ |
| 297 |
if [ "$$UWATCHCONFCHECK" -ne "Ok" ] ; then \ |
| 298 |
exit 1 ; \ |
| 299 |
fi ; \ |
| 300 |
if [ ! -n '$(UFILES_REGEX)' ]; then \ |
| 301 |
VERSIONLIST=`HTTPS_PROXY=$(https_proxy) HTTP_PROXY=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/uwatch get-upstream-version-list --upstream-url="$(UPSTREAM_MASTER_SITES)" --gar-distfiles="$(DISTFILES)" --catalog-name="$(CATALOGNAME)"` ; \ |
| 302 |
else \ |
| 303 |
VERSIONLIST=`HTTPS_PROXY=$(https_proxy) HTTP_PROXY=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/uwatch get-upstream-version-list --upstream-url="$(UPSTREAM_MASTER_SITES)" --regexp="$(UFILES_REGEX)"` ; \ |
| 304 |
fi ; \ |
| 305 |
if [ "$$?" -ne "0" ] ; then \ |
| 306 |
echo "Error occured while executing uwatch get-upstream-version-list. Please check configuration with target get-uwatch-configuration. Here is the output of uwatch command :" ; \ |
| 307 |
echo "Output : $$VERSIONLIST" ; \ |
| 308 |
exit 1 ; \ |
| 309 |
fi; \ |
| 310 |
if [ -n "$$VERSIONLIST" ] ; then \ |
| 311 |
for VERSION in $$VERSIONLIST ; do \ |
| 312 |
if [ ! "$$VERSION" -eq "" ] ; then \ |
| 313 |
echo "$(NAME) - $$VERSION" ; \ |
| 314 |
fi ; \ |
| 315 |
done ; \ |
| 316 |
else \ |
| 317 |
echo "$(NAME) - No version found. Please check UPSTREAM_MASTER_SITES and UFILES_REGEX variables in the Makefile" ; \ |
| 318 |
fi ; \ |
| 319 |
fi ; |
| 320 |
|
| 321 |
######################################################## |
| 322 |
# Retrieve the newest upstream version |
| 323 |
# |
| 324 |
get-upstream-latest-version: |
| 325 |
@if [ '$(ENABLE_UWATCH)' -ne '1' ] ; then \ |
| 326 |
echo "$(NAME) - Upstream Watch is disabled" ; \ |
| 327 |
else \ |
| 328 |
UWATCHCONFCHECK="Ok" ; \ |
| 329 |
if [ ! -n '$(UFILES_REGEX)' ]; then \ |
| 330 |
echo "$(NAME) - UFILES_REGEX is not set - trying to guess it" ; \ |
| 331 |
fi; \ |
| 332 |
if [ ! -n '$(UPSTREAM_MASTER_SITES)' ]; then \ |
| 333 |
echo "$(NAME) - Error UPSTREAM_MASTER_SITES is not set" ; \ |
| 334 |
UWATCHCONFCHECK="Error" ; \ |
| 335 |
fi; \ |
| 336 |
if [ ! -n '$(VERSION)' ]; then \ |
| 337 |
echo "$(NAME) - Error VERSION is not set" ; \ |
| 338 |
UWATCHCONFCHECK="Error" ; \ |
| 339 |
fi; \ |
| 340 |
if [ "$$UWATCHCONFCHECK" -ne "Ok" ] ; then \ |
| 341 |
exit 1 ; \ |
| 342 |
fi ; \ |
| 343 |
if [ ! -n '$(UFILES_REGEX)' ]; then \ |
| 344 |
LATEST=`HTTPS_PROXY=$(https_proxy) HTTP_PROXY=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/uwatch get-upstream-latest-version --upstream-url="$(UPSTREAM_MASTER_SITES)" --gar-distfiles="$(DISTFILES)" --catalog-name="$(CATALOGNAME)"` ; \ |
| 345 |
else \ |
| 346 |
LATEST=`HTTPS_PROXY=$(https_proxy) HTTP_PROXY=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/uwatch get-upstream-latest-version --upstream-url="$(UPSTREAM_MASTER_SITES)" --regexp="$(UFILES_REGEX)"` ; \ |
| 347 |
fi ; \ |
| 348 |
if [ "$$?" -ne "0" ] ; then \ |
| 349 |
echo "Error occured while executing uwatch get-upstream-latest-version. Please check configuration with target get-uwatch-configuration. Here is the output of uwatch command :" ; \ |
| 350 |
echo "$$LATEST" ; \ |
| 351 |
exit 1 ; \ |
| 352 |
fi; \ |
| 353 |
if [ -n "$$LATEST" ] ; then \ |
| 354 |
echo "$(NAME) - Latest upstream version is $$LATEST" ; \ |
| 355 |
else \ |
| 356 |
echo "$(NAME) - No version found. Please check UPSTREAM_MASTER_SITES and UFILES_REGEX variables in the Makefile" ; \ |
| 357 |
fi ; \ |
| 358 |
fi ; |
| 359 |
|
| 360 |
######################################################## |
| 361 |
# Compare local and upstream versions |
| 362 |
# |
| 363 |
check-upstream: |
| 364 |
@if [ '$(ENABLE_UWATCH)' -ne '1' ] ; then \ |
| 365 |
echo "$(NAME) - Upstream Watch is disabled" ; \ |
| 366 |
else \ |
| 367 |
UWATCHCONFCHECK="Ok" ; \ |
| 368 |
if [ ! -n '$(UFILES_REGEX)' ]; then \ |
| 369 |
echo "$(NAME) - UFILES_REGEX is not set - trying to guess it" ; \ |
| 370 |
fi; \ |
| 371 |
if [ ! -n '$(UPSTREAM_MASTER_SITES)' ]; then \ |
| 372 |
echo "$(NAME) - Error UPSTREAM_MASTER_SITES is not set" ; \ |
| 373 |
UWATCHCONFCHECK="Error" ; \ |
| 374 |
fi; \ |
| 375 |
if [ ! -n '$(VERSION)' ]; then \ |
| 376 |
echo "$(NAME) - Error VERSION is not set" ; \ |
| 377 |
UWATCHCONFCHECK="Error" ; \ |
| 378 |
fi; \ |
| 379 |
if [ "$$UWATCHCONFCHECK" -ne "Ok" ] ; then \ |
| 380 |
exit 1 ; \ |
| 381 |
fi ; \ |
| 382 |
if [ ! -n '$(UFILES_REGEX)' ]; then \ |
| 383 |
LATEST=`HTTPS_PROXY=$(https_proxy) HTTP_PROXY=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/uwatch check-upstream --upstream-url="$(UPSTREAM_MASTER_SITES)" --gar-distfiles="$(DISTFILES)" --catalog-name="$(CATALOGNAME)" --current-version="$(VERSION)"` ; \ |
| 384 |
else \ |
| 385 |
LATEST=`HTTPS_PROXY=$(https_proxy) HTTP_PROXY=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/uwatch check-upstream --upstream-url="$(UPSTREAM_MASTER_SITES)" --regexp="$(UFILES_REGEX)" --current-version="$(VERSION)"` ; \ |
| 386 |
fi ; \ |
| 387 |
if [ "$$?" -ne "0" ] ; then \ |
| 388 |
echo "Error occured while executing uwatch check-upstream. Please check configuration with target get-uwatch-configuration. Here is the output of uwatch command :" ; \ |
| 389 |
echo "$$LATEST" ; \ |
| 390 |
exit 1 ; \ |
| 391 |
fi; \ |
| 392 |
if [ -n "$$LATEST" ] ; then \ |
| 393 |
echo "$(NAME) : A new version of upstream files is available. Package can be upgraded from version $(VERSION) to $$LATEST"; \ |
| 394 |
else \ |
| 395 |
echo "$(NAME) : Package is up-to-date. Current version is $(VERSION)" ; \ |
| 396 |
fi ; \ |
| 397 |
fi |
| 398 |
|
| 399 |
|
| 400 |
######################################################## |
| 401 |
# Create upgrade branch from current to latest upstream |
| 402 |
# |
| 403 |
upgrade-to-latest-upstream: |
| 404 |
@if [ '$(ENABLE_UWATCH)' -ne '1' ] ; then \ |
| 405 |
echo "$(NAME) - Upstream Watch is disabled" ; \ |
| 406 |
else \ |
| 407 |
UWATCHCONFCHECK="Ok" ; \ |
| 408 |
if [ ! -n '$(UFILES_REGEX)' ]; then \ |
| 409 |
echo "$(NAME) - UFILES_REGEX is not set - trying to guess it" ; \ |
| 410 |
fi; \ |
| 411 |
if [ ! -n '$(UPSTREAM_MASTER_SITES)' ]; then \ |
| 412 |
echo "$(NAME) - Error UPSTREAM_MASTER_SITES is not set" ; \ |
| 413 |
UWATCHCONFCHECK="Error" ; \ |
| 414 |
fi; \ |
| 415 |
if [ ! -n '$(VERSION)' ]; then \ |
| 416 |
echo "$(NAME) - Error VERSION is not set" ; \ |
| 417 |
UWATCHCONFCHECK="Error" ; \ |
| 418 |
fi; \ |
| 419 |
if [ "$$UWATCHCONFCHECK" -ne "Ok" ] ; then \ |
| 420 |
exit 1 ; \ |
| 421 |
fi ; \ |
| 422 |
if [ ! -n '$(UFILES_REGEX)' ]; then \ |
| 423 |
LATEST=`HTTPS_PROXY=$(https_proxy) HTTP_PROXY=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/uwatch check-upstream --upstream-url="$(UPSTREAM_MASTER_SITES)" --gar-distfiles="$(DISTFILES)" --catalog-name="$(CATALOGNAME)" --current-version="$(VERSION)"` ; \ |
| 424 |
else \ |
| 425 |
LATEST=`HTTPS_PROXY=$(https_proxy) HTTP_PROXY=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/uwatch check-upstream --upstream-url="$(UPSTREAM_MASTER_SITES)" --regexp="$(UFILES_REGEX)" --current-version="$(VERSION)"` ; \ |
| 426 |
fi ; \ |
| 427 |
if [ "$$?" -ne "0" ] ; then \ |
| 428 |
echo "Error occured while executing uwatch check-upstream. Please check configuration with target get-uwatch-configuration. Here is the output of uwatch command :" ; \ |
| 429 |
echo "$$LATEST" ; \ |
| 430 |
exit 1 ; \ |
| 431 |
fi; \ |
| 432 |
if [ ! -f "$(COOKIEDIR)/upgrade-to-latest-upstream-$$LATEST" ] ; then \ |
| 433 |
if [ ! -d "../branches/upgrade_from_$(VERSION)_to_$$LATEST" ] ; then \ |
| 434 |
if [ -n "$$LATEST" ] ; then \ |
| 435 |
echo "$(NAME) : a new version of upstream files is available. Creating upgrade branch from version $(VERSION) to $$LATEST"; \ |
| 436 |
VERSIONUPGRADE=`HTTPS_PROXY=$(https_proxy) HTTP_PROXY=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/uwatch upgrade-to-version --current-version="$(VERSION)" --target-version="$$LATEST"` ; \ |
| 437 |
if [ "$$?" -ne "0" ] ; then \ |
| 438 |
echo "Error occured while executing uwatch upgrade-to-version. Please check configuration with target get-uwatch-configuration. Here is the output of uwatch command :" ; \ |
| 439 |
echo "$$VERSIONUPGRADE" ; \ |
| 440 |
exit 1 ; \ |
| 441 |
fi; \ |
| 442 |
if [ -n "$$VERSIONUPGRADE" ] ; then \ |
| 443 |
echo "$(NAME) - $$VERSIONUPGRADE" ; \ |
| 444 |
fi ; \ |
| 445 |
else \ |
| 446 |
echo "$(NAME) : Package is up-to-date. Upstream site has no version newer than $(VERSION)" ; \ |
| 447 |
fi ; \ |
| 448 |
else \ |
| 449 |
echo "$(NAME) - Upgrade branch from version $(VERSION) to version $$LATEST already exist" ; \ |
| 450 |
fi ; \ |
| 451 |
$(MAKE) upgrade-to-latest-upstream-$$LATEST >/dev/null; \ |
| 452 |
else \ |
| 453 |
echo "$(NAME) - Upgrade branch to version $$LATEST already created by upstream_watch" ; \ |
| 454 |
fi ; \ |
| 455 |
fi |
| 456 |
|
| 457 |
|
| 458 |
######################################################## |
| 459 |
# Create upgrade branch from current to latest upstream |
| 460 |
# |
| 461 |
update-package-version-database:PACKAGELIST=$(foreach SPEC,$(SPKG_SPECS),$(call _pkglist_one,$(SPEC))\n) |
| 462 |
update-package-version-database: |
| 463 |
@EXECUTIONDATE=`date +"%Y-%m-%d %H:%M:%S"` ; \ |
| 464 |
if [ '$(ENABLE_UWATCH)' -ne '1' ] ; then \ |
| 465 |
echo "$(NAME) - Upstream Watch is disabled" ; \ |
| 466 |
printf "$(PACKAGELIST)" | while read line ; do \ |
| 467 |
GARPATH=`echo $$line | awk '{ print $$1 }'` ; \ |
| 468 |
CATALOGNAME=`echo $$line | awk '{ print $$2 }'` ; \ |
| 469 |
PKGNAME=`echo $$line | awk '{ print $$3 }'` ; \ |
| 470 |
REPORTVERSION=`HTTPS_PROXY=$(https_proxy) HTTP_PROXY=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/uwatch update-package-version-database --catalog-name="$$CATALOGNAME" --package-name="$$PKGNAME" --execution-date="$$EXECUTIONDATE" --gar-path="$$GARPATH" --gar-version="$(VERSION)" --upstream-url="$(UPSTREAM_MASTER_SITES)" --regexp="$(UFILES_REGEX)" --gar-distfiles="$(DISTFILES)" --uwatch-output="Upstream Watch is disabled" --uwatch-deactivated` ; \ |
| 471 |
if [ "$$?" -ne "0" ] ; then \ |
| 472 |
echo "Error occured while executing uwatch update-package-version-database --uwatch-deactivated. Please check configuration with target get-uwatch-configuration. Here is the output of uwatch command :" ; \ |
| 473 |
echo "$$REPORTVERSION" ; \ |
| 474 |
exit 1 ; \ |
| 475 |
fi; \ |
| 476 |
done ; \ |
| 477 |
if [ -n "$$REPORTVERSION" ] ; then \ |
| 478 |
echo "$(NAME) - $$REPORTVERSION" ; \ |
| 479 |
fi ; \ |
| 480 |
else \ |
| 481 |
UWATCHCONFCHECK="Ok" ; \ |
| 482 |
if [ ! -n '$(UFILES_REGEX)' ]; then \ |
| 483 |
echo "$(NAME) - UFILES_REGEX is not set - trying to guess it" ; \ |
| 484 |
fi; \ |
| 485 |
if [ ! -n '$(UPSTREAM_MASTER_SITES)' ]; then \ |
| 486 |
echo "$(NAME) - Error UPSTREAM_MASTER_SITES is not set" ; \ |
| 487 |
UWATCHCONFCHECK="Error" ; \ |
| 488 |
fi; \ |
| 489 |
if [ ! -n '$(VERSION)' ]; then \ |
| 490 |
echo "$(NAME) - Error VERSION is not set" ; \ |
| 491 |
UWATCHCONFCHECK="Error" ; \ |
| 492 |
fi; \ |
| 493 |
if [ "$$UWATCHCONFCHECK" -ne "Ok" ] ; then \ |
| 494 |
printf "$(PACKAGELIST)" | while read line ; do \ |
| 495 |
GARPATH=`echo $$line | awk '{ print $$1 }'` ; \ |
| 496 |
CATALOGNAME=`echo $$line | awk '{ print $$2 }'` ; \ |
| 497 |
PKGNAME=`echo $$line | awk '{ print $$3 }'` ; \ |
| 498 |
REPORTVERSION=`HTTPS_PROXY=$(https_proxy) HTTP_PROXY=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/uwatch update-package-version-database --catalog-name="$$CATALOGNAME" --package-name="$$PKGNAME" --execution-date="$$EXECUTIONDATE" --gar-path="$$GARPATH" --gar-version="$(VERSION)" --uwatch-error --upstream-url="$(UPSTREAM_MASTER_SITES)" --regexp="$(UFILES_REGEX)" --gar-distfiles="$(DISTFILES)" --uwatch-output="Upstream Watch configuration error" ` ; \ |
| 499 |
if [ "$$?" -ne "0" ] ; then \ |
| 500 |
echo "Error occured while executing uwatch update-package-version-database --uwatch-error. Please check configuration with target get-uwatch-configuration. Here is the output of uwatch command :" ; \ |
| 501 |
echo "$$REPORTVERSION" ; \ |
| 502 |
exit 1 ; \ |
| 503 |
fi; \ |
| 504 |
done ; \ |
| 505 |
exit 1 ; \ |
| 506 |
fi ; \ |
| 507 |
if [ ! -n '$(UFILES_REGEX)' ]; then \ |
| 508 |
LATEST=`HTTPS_PROXY=$(https_proxy) HTTP_PROXY=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/uwatch get-upstream-latest-version --upstream-url="$(UPSTREAM_MASTER_SITES)" --gar-distfiles="$(DISTFILES)" --catalog-name="$(CATALOGNAME)"` ; \ |
| 509 |
else \ |
| 510 |
LATEST=`HTTPS_PROXY=$(https_proxy) HTTP_PROXY=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/uwatch get-upstream-latest-version --upstream-url="$(UPSTREAM_MASTER_SITES)" --regexp="$(UFILES_REGEX)"` ; \ |
| 511 |
fi ; \ |
| 512 |
if [ "$$?" -ne "0" ] ; then \ |
| 513 |
echo "Error occured while executing uwatch get-upstream-latest-version. Please check configuration with target get-uwatch-configuration. Here is the output of uwatch command :" ; \ |
| 514 |
echo "$$LATEST" ; \ |
| 515 |
printf "$(PACKAGELIST)" | while read line ; do \ |
| 516 |
GARPATH=`echo $$line | awk '{ print $$1 }'` ; \ |
| 517 |
CATALOGNAME=`echo $$line | awk '{ print $$2 }'` ; \ |
| 518 |
PKGNAME=`echo $$line | awk '{ print $$3 }'` ; \ |
| 519 |
REPORTVERSION=`HTTPS_PROXY=$(https_proxy) HTTP_PROXY=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/uwatch update-package-version-database --catalog-name="$$CATALOGNAME" --package-name="$$PKGNAME" --execution-date="$$EXECUTIONDATE" --gar-path="$$GARPATH" --gar-version="$(VERSION)" --uwatch-error --upstream-url="$(UPSTREAM_MASTER_SITES)" --regexp="$(UFILES_REGEX)" --gar-distfiles="$(DISTFILES)" --uwatch-output="$$LATEST" ` ; \ |
| 520 |
if [ "$$?" -ne "0" ] ; then \ |
| 521 |
echo "Error occured while executing uwatch update-package-version-database --uwatch-error. Please check configuration with target get-uwatch-configuration. Here is the output of uwatch command :" ; \ |
| 522 |
echo "$$REPORTVERSION" ; \ |
| 523 |
exit 1 ; \ |
| 524 |
fi; \ |
| 525 |
done ; \ |
| 526 |
exit 1 ; \ |
| 527 |
fi; \ |
| 528 |
printf "$(PACKAGELIST)" | while read line ; do \ |
| 529 |
GARPATH=`echo $$line | awk '{ print $$1 }'` ; \ |
| 530 |
CATALOGNAME=`echo $$line | awk '{ print $$2 }'` ; \ |
| 531 |
PKGNAME=`echo $$line | awk '{ print $$3 }'` ; \ |
| 532 |
if [ ! -n '$(UFILES_REGEX)' ]; then \ |
| 533 |
REPORTVERSION=`HTTPS_PROXY=$(https_proxy) HTTP_PROXY=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/uwatch update-package-version-database --catalog-name="$$CATALOGNAME" --package-name="$$PKGNAME" --execution-date="$$EXECUTIONDATE" --gar-path="$$GARPATH" --gar-version=$(VERSION) --upstream-version="$$LATEST" --upstream-url="$(UPSTREAM_MASTER_SITES)" --gar-distfiles="$(DISTFILES)" --uwatch-output="Successful" ` ; \ |
| 534 |
else \ |
| 535 |
REPORTVERSION=`HTTPS_PROXY=$(https_proxy) HTTP_PROXY=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/uwatch update-package-version-database --catalog-name="$$CATALOGNAME" --package-name="$$PKGNAME" --execution-date="$$EXECUTIONDATE" --gar-path="$$GARPATH" --gar-version=$(VERSION) --upstream-version="$$LATEST" --upstream-url="$(UPSTREAM_MASTER_SITES)" --regexp="$(UFILES_REGEX)" --gar-distfiles="$(DISTFILES)" --uwatch-output="Successful" ` ; \ |
| 536 |
fi ; \ |
| 537 |
if [ "$$?" -ne "0" ] ; then \ |
| 538 |
echo "Error occured while executing uwatch update-package-version-database. Please check configuration with target get-uwatch-configuration. Here is the output of uwatch command :" ; \ |
| 539 |
echo "$$REPORTVERSION" ; \ |
| 540 |
REPORTVERSION=`HTTPS_PROXY=$(https_proxy) HTTP_PROXY=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/uwatch update-package-version-database --catalog-name="$$CATALOGNAME" --package-name="$$PKGNAME" --execution-date="$$EXECUTIONDATE" --gar-path="$$GARPATH" --gar-version="$(VERSION)" --uwatch-error --upstream-url="$(UPSTREAM_MASTER_SITES)" --regexp="$(UFILES_REGEX)" --gar-distfiles="$(DISTFILES)" --uwatch-output="$$REPORTVERSION" ` ; \ |
| 541 |
if [ "$$?" -ne "0" ] ; then \ |
| 542 |
echo "Error occured while executing uwatch update-package-version-database --uwatch-error. Please check configuration with target get-uwatch-configuration. Here is the output of uwatch command :" ; \ |
| 543 |
echo "$$REPORTVERSION" ; \ |
| 544 |
exit 1 ; \ |
| 545 |
fi; \ |
| 546 |
exit 1 ; \ |
| 547 |
fi; \ |
| 548 |
done ; \ |
| 549 |
if [ -n "$$REPORTVERSION" ] ; then \ |
| 550 |
echo "$(NAME) - $$REPORTVERSION" ; \ |
| 551 |
fi ; \ |
| 552 |
fi |
| 553 |
|
| 554 |
# |
| 555 |
|
| 556 |
######################################################## |
| 557 |
# |
| 558 |
get-gar-version: |
| 559 |
@if [ ! -n '$(VERSION)' ]; then \ |
| 560 |
echo "$(NAME) - VERSION is not defined" ; \ |
| 561 |
exit 1 ; \ |
| 562 |
else \ |
| 563 |
echo "$(NAME) - GAR version is $(VERSION)" ; \ |
| 564 |
fi ; |
| 565 |
|
| 566 |
upgrade-to-latest-upstream-%: |
| 567 |
@$(MAKECOOKIE) |
| 568 |
|
| 569 |
|
| 570 |
#################### GARCHIVE RULES #################### |
| 571 |
|
| 572 |
# while we're here, let's just handle how to back up our |
| 573 |
# checksummed files |
| 574 |
|
| 575 |
$(GARCHIVEDIR)/%: $(GARCHIVEDIR) |
| 576 |
$(if $(filter %.hg,$*),(cd $(DOWNLOADDIR)/$(*:%.hg=%) && \ |
| 577 |
hg archive --prefix=$(DISTNAME)/ --rev=$(call HG_TREEISH,$(*:%.hg=%)) --type tar - | gzip > $(GARCHIVEDIR)/$(GARCHDISTNAME) && \ |
| 578 |
rm -f $(GARCHDISTNAME) && ln -s $(GARCHIVEDIR)/$(GARCHDISTNAME) . ), \ |
| 579 |
@if [ -h $(DOWNLOADDIR)/$* ]; then :; else \ |
| 580 |
gcp -Lr $(DOWNLOADDIR)/$* $@; \ |
| 581 |
fi ) |
| 582 |
|
| 583 |
|
| 584 |
#################### EXTRACT RULES #################### |
| 585 |
|
| 586 |
TAR_ARGS = --no-same-owner |
| 587 |
|
| 588 |
# rule to extract uncompressed tarballs |
| 589 |
tar-extract-%: |
| 590 |
@echo " ==> Extracting $(DOWNLOADDIR)/$*" |
| 591 |
@gtar $(TAR_ARGS) -xf $(DOWNLOADDIR)/$* -C $(EXTRACTDIR) |
| 592 |
@$(MAKECOOKIE) |
| 593 |
|
| 594 |
# rule to extract files with tar xzf |
| 595 |
tar-gz-extract-%: |
| 596 |
@echo " ==> Extracting $(DOWNLOADDIR)/$*" |
| 597 |
@gzip -dc $(DOWNLOADDIR)/$* | gtar $(TAR_ARGS) -xf - -C $(EXTRACTDIR) |
| 598 |
@$(MAKECOOKIE) |
| 599 |
|
| 600 |
# rule to extract files with tar and bzip |
| 601 |
tar-bz-extract-%: |
| 602 |
@echo " ==> Extracting $(DOWNLOADDIR)/$*" |
| 603 |
@bzip2 -dc $(DOWNLOADDIR)/$* | gtar $(TAR_ARGS) -xf - -C $(EXTRACTDIR) |
| 604 |
@$(MAKECOOKIE) |
| 605 |
|
| 606 |
# rule to extract files with tar and xz |
| 607 |
tar-xz-extract-%: |
| 608 |
@echo " ==> Extracting $(DOWNLOADDIR)/$*" |
| 609 |
@xz -dc $(DOWNLOADDIR)/$* | gtar $(TAR_ARGS) -xf - -C $(EXTRACTDIR) |
| 610 |
@$(MAKECOOKIE) |
| 611 |
|
| 612 |
# rule to extract files with tar and lz |
| 613 |
tar-lz-extract-%: |
| 614 |
@echo " ==> Extracting $(DOWNLOADDIR)/$*" |
| 615 |
@lzip -dc $(DOWNLOADDIR)/$* | gtar $(TAR_ARGS) -xf - -C $(EXTRACTDIR) |
| 616 |
@$(MAKECOOKIE) |
| 617 |
|
| 618 |
# rule to extract files with tar and lzma |
| 619 |
tar-lzma-extract-%: |
| 620 |
@echo " ==> Extracting $(DOWNLOADDIR)/$*" |
| 621 |
@lzma -dc $(DOWNLOADDIR)/$* | gtar $(TAR_ARGS) -xf - -C $(EXTRACTDIR) |
| 622 |
@$(MAKECOOKIE) |
| 623 |
|
| 624 |
# extract compressed single files |
| 625 |
gz-extract-%: |
| 626 |
@echo " ==> Decompressing $(DOWNLOADDIR)/$*" |
| 627 |
@cp $(DOWNLOADDIR)/$* $(WORKDIR)/ |
| 628 |
@gzip -d $(WORKDIR)/$* |
| 629 |
@$(MAKECOOKIE) |
| 630 |
|
| 631 |
gz-extract-%: |
| 632 |
@echo " ==> Decompressing $(DOWNLOADDIR)/$*" |
| 633 |
@cp $(DOWNLOADDIR)/$* $(WORKDIR)/ |
| 634 |
@gzip -d $(WORKDIR)/$* |
| 635 |
@$(MAKECOOKIE) |
| 636 |
|
| 637 |
xz-extract-%: |
| 638 |
@echo " ==> Decompressing $(DOWNLOADDIR)/$*" |
| 639 |
@cp $(DOWNLOADDIR)/$* $(WORKDIR)/ |
| 640 |
@xz -d $(WORKDIR)/$* |
| 641 |
@$(MAKECOOKIE) |
| 642 |
|
| 643 |
lz-extract-%: |
| 644 |
@echo " ==> Decompressing $(DOWNLOADDIR)/$*" |
| 645 |
@cp $(DOWNLOADDIR)/$* $(WORKDIR)/ |
| 646 |
@lzip -d $(WORKDIR)/$* |
| 647 |
@$(MAKECOOKIE) |
| 648 |
|
| 649 |
lzma-extract-%: |
| 650 |
@echo " ==> Decompressing $(DOWNLOADDIR)/$*" |
| 651 |
@cp $(DOWNLOADDIR)/$* $(WORKDIR)/ |
| 652 |
@lzma -d $(WORKDIR)/$* |
| 653 |
@$(MAKECOOKIE) |
| 654 |
|
| 655 |
# extra dependency rule for git repos, that will allow the user |
| 656 |
# to supply an alternate target at their discretion |
| 657 |
git-extract-%: |
| 658 |
@echo " ===> Extracting Git Repo $(DOWNLOADDIR)/$* (Treeish: $(call GIT_TREEISH,$*))" |
| 659 |
( cd $(abspath $(DOWNLOADDIR))/$*/; git --bare archive --prefix=$(NAME)-$(VERSION)/ $(call GIT_TREEISH,$*)) | gtar -xf - -C $(EXTRACTDIR) |
| 660 |
@$(MAKECOOKIE) |
| 661 |
hg-extract-%: |
| 662 |
@echo " ===> Extracting Mercurial Repo $(DOWNLOADDIR)/$* (Tag: $(call HG_TREEISH,$(*:%.hg=%)))" |
| 663 |
( cd $(abspath $(DOWNLOADDIR))/$*/; hg archive --prefix=$(DISTNAME)/ --rev=$(call HG_TREEISH,$(*:%.hg=%)) --type tar -)| gtar -xf - -C $(EXTRACTDIR) |
| 664 |
@$(MAKECOOKIE) |
| 665 |
|
| 666 |
# rule to extract files with unzip |
| 667 |
zip-extract-%: |
| 668 |
@echo " ==> Extracting $(DOWNLOADDIR)/$*" |
| 669 |
@unzip $(DOWNLOADDIR)/$* -d $(EXTRACTDIR) |
| 670 |
@$(MAKECOOKIE) |
| 671 |
|
| 672 |
# this is a null extract rule for files which are constant and |
| 673 |
# unchanged (not archives) |
| 674 |
cp-extract-%: |
| 675 |
@echo " ==> Copying $(DOWNLOADDIR)/$*" |
| 676 |
@# Make sure to keep symlinks and don't traverse recursive ones |
| 677 |
@(cd $(DOWNLOADDIR); gtar cf - $*) | (cd $(WORKDIR); gtar xf -) |
| 678 |
@$(MAKECOOKIE) |
| 679 |
|
| 680 |
#gets the meat of a .deb into $(WORKSRC) |
| 681 |
deb-bin-extract-%: |
| 682 |
@echo " ==> Extracting $(DOWNLOADDIR)/$*" |
| 683 |
@ar x $(DOWNLOADDIR)/$* |
| 684 |
@rm debian-binary && \ |
| 685 |
mv *.tar.gz $(DOWNLOADDIR) && \ |
| 686 |
mkdir $(WORKSRC) && \ |
| 687 |
gtar $(TAR_ARGS) -xvz -C $(WORKSRC) \ |
| 688 |
-f $(DOWNLOADDIR)/data.tar.gz |
| 689 |
@$(MAKECOOKIE) |
| 690 |
|
| 691 |
### EXTRACT FILE TYPE MAPPINGS ### |
| 692 |
# These rules specify which of the above extract action rules to use for a |
| 693 |
# given file extension. Often support for a given extract type can be handled |
| 694 |
# by simply adding a rule here. |
| 695 |
|
| 696 |
extract-archive-%.tar: tar-extract-%.tar |
| 697 |
@$(MAKECOOKIE) |
| 698 |
|
| 699 |
extract-archive-%.tar.gz: tar-gz-extract-%.tar.gz |
| 700 |
@$(MAKECOOKIE) |
| 701 |
|
| 702 |
extract-archive-%.tar.Z: tar-gz-extract-%.tar.Z |
| 703 |
@$(MAKECOOKIE) |
| 704 |
|
| 705 |
extract-archive-%.tgz: tar-gz-extract-%.tgz |
| 706 |
@$(MAKECOOKIE) |
| 707 |
|
| 708 |
extract-archive-%.taz: tar-gz-extract-%.taz |
| 709 |
@$(MAKECOOKIE) |
| 710 |
|
| 711 |
extract-archive-%.tar.bz: tar-bz-extract-%.tar.bz |
| 712 |
@$(MAKECOOKIE) |
| 713 |
|
| 714 |
extract-archive-%.tar.bz2: tar-bz-extract-%.tar.bz2 |
| 715 |
@$(MAKECOOKIE) |
| 716 |
|
| 717 |
extract-archive-%.tbz: tar-bz-extract-%.tbz |
| 718 |
@$(MAKECOOKIE) |
| 719 |
|
| 720 |
extract-archive-%.tar.xz: tar-xz-extract-%.tar.xz |
| 721 |
@$(MAKECOOKIE) |
| 722 |
|
| 723 |
extract-archive-%.tar.lz: tar-lz-extract-%.tar.lz |
| 724 |
@$(MAKECOOKIE) |
| 725 |
|
| 726 |
extract-archive-%.tar.lzma: tar-lzma-extract-%.tar.lzma |
| 727 |
@$(MAKECOOKIE) |
| 728 |
|
| 729 |
extract-archive-%.zip: zip-extract-%.zip |
| 730 |
@$(MAKECOOKIE) |
| 731 |
|
| 732 |
extract-archive-%.ZIP: zip-extract-%.ZIP |
| 733 |
@$(MAKECOOKIE) |
| 734 |
|
| 735 |
extract-archive-%.deb: deb-bin-extract-%.deb |
| 736 |
@$(MAKECOOKIE) |
| 737 |
|
| 738 |
extract-archive-%.gz: gz-extract-%.gz |
| 739 |
@$(MAKECOOKIE) |
| 740 |
|
| 741 |
extract-archive-%.bz2: bz-extract-%.bz2 |
| 742 |
@$(MAKECOOKIE) |
| 743 |
|
| 744 |
extract-archive-%.xz: xz-extract-%.xz |
| 745 |
@$(MAKECOOKIE) |
| 746 |
|
| 747 |
extract-archive-%.lz: lz-extract-%.lz |
| 748 |
@$(MAKECOOKIE) |
| 749 |
|
| 750 |
extract-archive-%.lzma: lzma-extract-%.lzma |
| 751 |
@$(MAKECOOKIE) |
| 752 |
|
| 753 |
extract-archive-%.git: git-extract-%.git |
| 754 |
@$(MAKECOOKIE) |
| 755 |
|
| 756 |
extract-archive-%.hg: hg-extract-% |
| 757 |
@$(MAKECOOKIE) |
| 758 |
|
| 759 |
extract-copy-%: cp-extract-% |
| 760 |
@$(MAKECOOKIE) |
| 761 |
|
| 762 |
# anything we don't know about, we just assume is already |
| 763 |
# uncompressed and unarchived in plain format |
| 764 |
extract-archive-%: cp-extract-% |
| 765 |
@$(MAKECOOKIE) |
| 766 |
|
| 767 |
#################### PATCH RULES #################### |
| 768 |
|
| 769 |
PATCHDIR ?= $(WORKDIR)/$(DISTNAME) |
| 770 |
PATCHDIRLEVEL ?= 1 |
| 771 |
PATCHDIRFUZZ ?= 2 |
| 772 |
GARPATCH = gpatch -d$(PATCHDIR) -p$(PATCHDIRLEVEL) -F$(PATCHDIRFUZZ) |
| 773 |
BASEWORKSRC = $(shell basename $(WORKSRC)) |
| 774 |
|
| 775 |
# apply xzipped patches |
| 776 |
xz-patch-%: |
| 777 |
@echo " ==> Applying patch $(DOWNLOADDIR)/$*" |
| 778 |
@xz -dc $(DOWNLOADDIR)/$* | $(GARPATCH) || exit 1 |
| 779 |
@( if [ -z "$(NOGITPATCH)" ]; then \ |
| 780 |
cd $(PATCHDIR); git add -A; \ |
| 781 |
git commit -am "old xz-style patch: $*"; \ |
| 782 |
fi ) |
| 783 |
@$(MAKECOOKIE) |
| 784 |
|
| 785 |
# apply bzipped patches |
| 786 |
bz-patch-%: |
| 787 |
@echo " ==> Applying patch $(DOWNLOADDIR)/$*" |
| 788 |
@bzip2 -dc $(DOWNLOADDIR)/$* | $(GARPATCH) || exit 1 |
| 789 |
@( if [ -z "$(NOGITPATCH)" ]; then \ |
| 790 |
cd $(PATCHDIR); git add -A; \ |
| 791 |
git commit -am "old bz-style patch: $*"; \ |
| 792 |
fi ) |
| 793 |
@$(MAKECOOKIE) |
| 794 |
|
| 795 |
# apply gzipped patches |
| 796 |
gz-patch-%: |
| 797 |
@echo " ==> Applying patch $(DOWNLOADDIR)/$*" |
| 798 |
@gzip -dc $(DOWNLOADDIR)/$* | $(GARPATCH) || exit 1 |
| 799 |
@( if [ -z "$(NOGITPATCH)" ]; then \ |
| 800 |
cd $(PATCHDIR); git add -A; \ |
| 801 |
git commit -am "old gz-style patch: $*"; \ |
| 802 |
fi ) |
| 803 |
@$(MAKECOOKIE) |
| 804 |
|
| 805 |
# apply normal patches (git format-patch output or old-style diff -r) |
| 806 |
normal-patch-%: |
| 807 |
@echo " ==> Applying patch $(DOWNLOADDIR)/$*" |
| 808 |
@( if ggrep -q 'diff --git' $(abspath $(DOWNLOADDIR)/$*); then \ |
| 809 |
if [ -z "$(NOGITPATCH)" ]; then \ |
| 810 |
cd $(PATCHDIR);\ |
| 811 |
git am --ignore-space-change --ignore-whitespace $(abspath $(DOWNLOADDIR)/$*) || exit 1; \ |
| 812 |
else \ |
| 813 |
$(GARPATCH) < $(DOWNLOADDIR)/$* || exit 1; \ |
| 814 |
fi; \ |
| 815 |
else \ |
| 816 |
echo Adding old-style patch...; \ |
| 817 |
$(GARPATCH) < $(DOWNLOADDIR)/$* || exit 1; \ |
| 818 |
if [ -z "$(NOGITPATCH)" ]; then \ |
| 819 |
cd $(PATCHDIR); \ |
| 820 |
git add -A; \ |
| 821 |
git commit -am "old style patch: $*"; \ |
| 822 |
fi; \ |
| 823 |
fi ) |
| 824 |
@$(MAKECOOKIE) |
| 825 |
|
| 826 |
### PATCH FILE TYPE MAPPINGS ### |
| 827 |
# These rules specify which of the above patch action rules to use for a given |
| 828 |
# file extension. Often support for a given patch format can be handled by |
| 829 |
# simply adding a rule here. |
| 830 |
|
| 831 |
patch-extract-%.xz: xz-patch-%.xz |
| 832 |
@$(MAKECOOKIE) |
| 833 |
|
| 834 |
patch-extract-%.bz: bz-patch-%.bz |
| 835 |
@$(MAKECOOKIE) |
| 836 |
|
| 837 |
patch-extract-%.bz2: bz-patch-%.bz2 |
| 838 |
@$(MAKECOOKIE) |
| 839 |
|
| 840 |
patch-extract-%.gz: gz-patch-%.gz |
| 841 |
@$(MAKECOOKIE) |
| 842 |
|
| 843 |
patch-extract-%.Z: gz-patch-%.Z |
| 844 |
@$(MAKECOOKIE) |
| 845 |
|
| 846 |
patch-extract-%.diff: normal-patch-%.diff |
| 847 |
@$(MAKECOOKIE) |
| 848 |
|
| 849 |
patch-extract-%.patch: normal-patch-%.patch |
| 850 |
@$(MAKECOOKIE) |
| 851 |
|
| 852 |
patch-extract-%: normal-patch-% |
| 853 |
@$(MAKECOOKIE) |
| 854 |
|
| 855 |
#################### CONFIGURE RULES #################### |
| 856 |
|
| 857 |
TMP_DIRPATHS = --prefix=$(prefix) --exec_prefix=$(exec_prefix) --bindir=$(bindir) --sbindir=$(sbindir) --libexecdir=$(libexecdir) --datadir=$(datadir) --sysconfdir=$(sysconfdir) --sharedstatedir=$(sharedstatedir) --localstatedir=$(localstatedir) --libdir=$(libdir) --infodir=$(infodir) --lispdir=$(lispdir) --includedir=$(includedir) --mandir=$(mandir) |
| 858 |
|
| 859 |
NODIRPATHS += --lispdir |
| 860 |
|
| 861 |
DIRPATHS = $(filter-out $(addsuffix %,$(NODIRPATHS)), $(TMP_DIRPATHS)) |
| 862 |
|
| 863 |
CONFIGURE_ARGS ?= $(DIRPATHS) $(EXTRA_CONFIGURE_ARGS) |
| 864 |
|
| 865 |
# configure a package that has an autoconf-style configure |
| 866 |
# script. |
| 867 |
configure-%/configure: |
| 868 |
@echo " ==> Running configure in $*" |
| 869 |
cd $* && mkdir -p $(OBJDIR) && cd $(OBJDIR) && /usr/bin/env -i $(CONFIGURE_ENV) $(abspath $*)/configure $(CONFIGURE_ARGS) |
| 870 |
@$(MAKECOOKIE) |
| 871 |
|
| 872 |
configure-%/autogen.sh: |
| 873 |
@echo " ==> Running autogen.sh in $*" |
| 874 |
cd $* && mkdir -p $(OBJDIR) && cd $(OBJDIR) && $(CONFIGURE_ENV) $(abspath $*)/autogen.sh $(CONFIGURE_ARGS) |
| 875 |
@$(MAKECOOKIE) |
| 876 |
|
| 877 |
# configure a package that uses imake |
| 878 |
# FIXME: untested and likely not the right way to handle the |
| 879 |
# arguments |
| 880 |
configure-%/Imakefile: |
| 881 |
@echo " ==> Running xmkmf in $*" |
| 882 |
@cd $* && $(CONFIGURE_ENV) xmkmf $(CONFIGURE_ARGS) |
| 883 |
@$(MAKECOOKIE) |
| 884 |
|
| 885 |
configure-%/setup.rb: |
| 886 |
@echo " ==> Running setup.rb config in $*" |
| 887 |
@( cd $* ; $(CONFIGURE_ENV) ruby ./setup.rb config $(CONFIGURE_ARGS) ) |
| 888 |
@$(MAKECOOKIE) |
| 889 |
|
| 890 |
# WAF build, for details see http://code.google.com/p/waf/ |
| 891 |
configure-%/waf: |
| 892 |
@echo " ==> Running waf configure in $*" |
| 893 |
cd $* && $(CONFIGURE_ENV) ./waf configure $(CONFIGURE_ARGS) |
| 894 |
@$(MAKECOOKIE) |
| 895 |
|
| 896 |
PYCONFIGURE_CMD = config |
| 897 |
configure-%/setup.py: |
| 898 |
@echo " ==> Running setup.py $(PYBUILD_TYPE) in $*" |
| 899 |
@( cd $* ; $(CONFIGURE_ENV) $(PYTHON_EXECUTABLE) ./setup.py $(PYCONFIGURE_CMD) $(CONFIGURE_ARGS) ) |
| 900 |
@$(MAKECOOKIE) |
| 901 |
|
| 902 |
|
| 903 |
#################### BUILD RULES #################### |
| 904 |
|
| 905 |
# build from a standard gnu-style makefile's default rule. |
| 906 |
build-%/Makefile: |
| 907 |
@echo " ==> Running make in $*" |
| 908 |
cd $* && /usr/bin/env -i $(BUILD_ENV) MAKEFLAGS= $(MAKE) $(PARALLELMFLAGS) $(foreach TTT,$(BUILD_OVERRIDE_VARS),$(TTT)="$(BUILD_OVERRIDE_VAR_$(TTT))") $(foreach TTT,$(BUILD_OVERRIDE_DIRS),$(TTT)="$($(TTT))") -C $(OBJDIR) $(BUILD_ARGS) |
| 909 |
@$(MAKECOOKIE) |
| 910 |
|
| 911 |
build-%/makefile: |
| 912 |
@echo " ==> Running make in $*" |
| 913 |
cd $* && /usr/bin/env -i $(BUILD_ENV) MAKEFLAGS= $(MAKE) $(PARALLELMFLAGS) $(foreach TTT,$(BUILD_OVERRIDE_VARS),$(TTT)="$(BUILD_OVERRIDE_VAR_$(TTT))") $(foreach TTT,$(BUILD_OVERRIDE_DIRS),$(TTT)="$($(TTT))") -C $(OBJDIR) $(BUILD_ARGS) |
| 914 |
@$(MAKECOOKIE) |
| 915 |
|
| 916 |
build-%/GNUmakefile: |
| 917 |
@echo " ==> Running make in $*" |
| 918 |
cd $* && /usr/bin/env -i $(BUILD_ENV) MAKEFLAGS= $(MAKE) $(PARALLELMFLAGS) $(foreach TTT,$(BUILD_OVERRIDE_VARS),$(TTT)="$(BUILD_OVERRIDE_VAR_$(TTT))") $(foreach TTT,$(BUILD_OVERRIDE_DIRS),$(TTT)="$($(TTT))") -C $(OBJDIR) $(BUILD_ARGS) |
| 919 |
@$(MAKECOOKIE) |
| 920 |
|
| 921 |
build-%/Jamfile: |
| 922 |
@echo " ==> Running bjam in $*" |
| 923 |
@( cd $* ; $(BUILD_ENV) bjam $(JAMFLAGS) $(BUILD_ARGS) ) |
| 924 |
@$(MAKECOOKIE) |
| 925 |
|
| 926 |
# Ruby makefiles |
| 927 |
build-%/Rakefile: |
| 928 |
@echo " ==> Running rake in $*" |
| 929 |
@( cd $* ; $(BUILD_ENV) rake $(RAKEFLAGS) $(BUILD_ARGS) ) |
| 930 |
@$(MAKECOOKIE) |
| 931 |
|
| 932 |
build-%/rakefile: |
| 933 |
@echo " ==> Running rake in $*" |
| 934 |
@( cd $* ; $(BUILD_ENV) rake $(RAKEFLAGS) $(BUILD_ARGS) ) |
| 935 |
@$(MAKECOOKIE) |
| 936 |
|
| 937 |
build-%/setup.rb: |
| 938 |
@echo " ==> Running setup.rb setup in $*" |
| 939 |
@( cd $* ; $(BUILD_ENV) ruby ./setup.rb setup $(BUILD_ARGS) ) |
| 940 |
@$(MAKECOOKIE) |
| 941 |
|
| 942 |
# WAF build, for details see http://code.google.com/p/waf/ |
| 943 |
build-%/waf: |
| 944 |
@echo " ==> Running waf build in $*" |
| 945 |
(cd $* ; $(BUILD_ENV) ./waf build $(BUILD_ARGS) ) |
| 946 |
@$(MAKECOOKIE) |
| 947 |
|
| 948 |
# This can be: build, build_py, build_ext, build_clib, build_scripts |
| 949 |
# See setup.py --help-commands for details |
| 950 |
PYBUILD_CMD ?= build |
| 951 |
build-%/setup.py: |
| 952 |
@echo " ==> Running setup.py $(PYBUILD_TYPE) in $*" |
| 953 |
@( cd $* ; $(BUILD_ENV) $(PYTHON_EXECUTABLE) ./setup.py $(PYBUILD_CMD) $(BUILD_ARGS) ) |
| 954 |
@$(MAKECOOKIE) |
| 955 |
|
| 956 |
#################### CLEAN RULES #################### |
| 957 |
|
| 958 |
CLEAN_ARGS ?= clean |
| 959 |
|
| 960 |
# build from a standard gnu-style makefile's default rule. |
| 961 |
clean-%/Makefile: |
| 962 |
@echo " ==> Running clean in $*" |
| 963 |
@cd $* && /usr/bin/env -i $(BUILD_ENV) MAKEFLAGS= $(MAKE) $(foreach TTT,$(BUILD_OVERRIDE_DIRS),$(TTT)="$($(TTT))") -C $(OBJDIR) $(CLEAN_ARGS) |
| 964 |
@rm -f $(COOKIEDIR)/build-$* |
| 965 |
|
| 966 |
clean-%/makefile: |
| 967 |
@echo " ==> Running clean in $*" |
| 968 |
@cd $* && $(BUILD_ENV) MAKEFLAGS= $(MAKE) $(foreach TTT,$(BUILD_OVERRIDE_DIRS),$(TTT)="$($(TTT))") -C $(OBJDIR) $(CLEAN_ARGS) |
| 969 |
@rm -f $(COOKIEDIR)/build-$* |
| 970 |
|
| 971 |
clean-%/GNUmakefile: |
| 972 |
@echo " ==> Running clean in $*" |
| 973 |
@cd $* && $(BUILD_ENV) MAKEFLAGS= $(MAKE) $(foreach TTT,$(BUILD_OVERRIDE_DIRS),$(TTT)="$($(TTT))") -C $(OBJDIR) $(CLEAN_ARGS) |
| 974 |
@rm -f $(COOKIEDIR)/build-$* |
| 975 |
|
| 976 |
clean-%/Jamfile: |
| 977 |
$(error *** Don't know how to clean Jamfiles) |
| 978 |
|
| 979 |
clean-%/Rakefile: |
| 980 |
$(error *** Don't know how to clean Rakefiles) |
| 981 |
|
| 982 |
clean-%/rakefile: |
| 983 |
$(error *** Don't know how to clean Rakefiles) |
| 984 |
|
| 985 |
clean-%/setup.rb: |
| 986 |
$(error *** Don't know how to clean Ruby setups) |
| 987 |
|
| 988 |
clean-%/setup.py: |
| 989 |
$(error *** Don't know how to clean Python builds) |
| 990 |
|
| 991 |
#################### TEST RULES #################### |
| 992 |
|
| 993 |
TEST_TARGET ?= check |
| 994 |
|
| 995 |
# Run tests on pre-built sources |
| 996 |
test-%/Makefile: |
| 997 |
@echo " ==> Running make $(TEST_TARGET) in $*" |
| 998 |
cd $* && /usr/bin/env -i $(TEST_ENV) MAKEFLAGS= $(MAKE) $(PARALLELMFLAGS) $(foreach TTT,$(TEST_OVERRIDE_VARS),$(TTT)="$(TEST_OVERRIDE_VAR_$(TTT))") $(foreach TTT,$(TEST_OVERRIDE_DIRS),$(TTT)="$($(TTT))") -C $(OBJDIR) $(TEST_ARGS) $(TEST_TARGET) |
| 999 |
@$(MAKECOOKIE) |
| 1000 |
|
| 1001 |
test-%/makefile: |
| 1002 |
@echo " ==> Running make $(TEST_TARGET) in $*" |
| 1003 |
@cd $* && $(TEST_ENV) MAKEFLAGS= $(MAKE) $(PARALLELMFLAGS) $(foreach TTT,$(TEST_OVERRIDE_VARS),$(TTT)="$(TEST_OVERRIDE_VAR_$(TTT))") $(foreach TTT,$(TEST_OVERRIDE_DIRS),$(TTT)="$($(TTT))") -C $(OBJDIR) $(TEST_ARGS) $(TEST_TARGET) |
| 1004 |
@$(MAKECOOKIE) |
| 1005 |
|
| 1006 |
test-%/GNUmakefile: |
| 1007 |
@echo " ==> Running make $(TEST_TARGET) in $*" |
| 1008 |
@cd $* && $(TEST_ENV) MAKEFLAGS= $(MAKE) $(PARALLELMFLAGS) $(foreach TTT,$(TEST_OVERRIDE_VARS),$(TTT)="$(TEST_OVERRIDE_VAR_$(TTT))") $(foreach TTT,$(TEST_OVERRIDE_DIRS),$(TTT)="$($(TTT))") -C $(OBJDIR) $(TEST_ARGS) $(TEST_TARGET) |
| 1009 |
@$(MAKECOOKIE) |
| 1010 |
|
| 1011 |
# Ruby makefiles |
| 1012 |
test-%/Rakefile: |
| 1013 |
@echo " ==> Running rake $(TEST_TARGET) in $*" |
| 1014 |
@( cd $* ; cd $(OBJDIR) ; $(TEST_ENV) rake $(RAKEFLAGS) $(TEST_ARGS) $(TEST_TARGET) ) |
| 1015 |
@$(MAKECOOKIE) |
| 1016 |
|
| 1017 |
test-%/rakefile: |
| 1018 |
@echo " ==> Running rake $(TEST_TARGET) in $*" |
| 1019 |
@( cd $* ; cd $(OBJDIR) ; $(TEST_ENV) rake $(RAKEFLAGS) $(TEST_ARGS) $(TEST_TARGET) ) |
| 1020 |
@$(MAKECOOKIE) |
| 1021 |
|
| 1022 |
# WAF build, for details see http://code.google.com/p/waf/ |
| 1023 |
test-%/waf: |
| 1024 |
@echo " ==> Running waf $(TEST_TARGET) in $*" |
| 1025 |
(cd $* ; $(BUILD_ENV) ./waf $(TEST_TARGET) ) |
| 1026 |
@$(MAKECOOKIE) |
| 1027 |
|
| 1028 |
test-%/setup.py: |
| 1029 |
@echo " ==> Running setup.py test in $*" |
| 1030 |
@( cd $* ; cd $(OBJDIR) ; $(TEST_ENV) $(PYTHON_EXECUTABLE) ./setup.py $(PYTHON_TEST_TARGET) $(TEST_ARGS) ) |
| 1031 |
@$(MAKECOOKIE) |
| 1032 |
|
| 1033 |
################# INSTALL RULES #################### |
| 1034 |
|
| 1035 |
# just run make install and hope for the best. |
| 1036 |
install-%/Makefile: INSTALL_OVERRIDE_VAR_DESTDIR ?= $(DESTDIR) |
| 1037 |
install-%/Makefile: |
| 1038 |
@echo " ==> Running make install in $*" |
| 1039 |
@cd $* && /usr/bin/env -i $(INSTALL_ENV) MAKEFLAGS= $(MAKE) $(foreach TTT,$(filter-out $(NO_CONFIGURE_EXPORTS),DESTDIR $(INSTALL_OVERRIDE_VARS)),$(TTT)="$(INSTALL_OVERRIDE_VAR_$(TTT))") $(foreach TTT,$(INSTALL_OVERRIDE_DIRS),$(TTT)="$(DESTDIR)$($(TTT))") -C $(OBJDIR) $(INSTALL_ARGS) install |
| 1040 |
@$(MAKECOOKIE) |
| 1041 |
|
| 1042 |
install-%/makefile: INSTALL_OVERRIDE_VAR_DESTDIR ?= $(DESTDIR) |
| 1043 |
install-%/makefile: |
| 1044 |
@echo " ==> Running make install in $*" |
| 1045 |
@cd $* && $(INSTALL_ENV) MAKEFLAGS= $(MAKE) $(foreach TTT,$(filter-out $(NO_CONFIGURE_EXPORTS),DESTDIR $(INSTALL_OVERRIDE_VARS)),$(TTT)="$(INSTALL_OVERRIDE_VAR_$(TTT))") $(foreach TTT,$(INSTALL_OVERRIDE_DIRS),$(TTT)="$(DESTDIR)$($(TTT))") -C $(OBJDIR) $(INSTALL_ARGS) install |
| 1046 |
@$(MAKECOOKIE) |
| 1047 |
|
| 1048 |
install-%/GNUmakefile: INSTALL_OVERRIDE_VAR_DESTDIR ?= $(DESTDIR) |
| 1049 |
install-%/GNUmakefile: |
| 1050 |
@echo " ==> Running make install in $*" |
| 1051 |
@cd $* && $(INSTALL_ENV) MAKEFLAGS= $(MAKE) $(foreach TTT,$(filter-out $(NO_CONFIGURE_EXPORTS),DESTDIR $(INSTALL_OVERRIDE_VARS)),$(TTT)="$(INSTALL_OVERRIDE_VAR_$(TTT))") $(foreach TTT,$(INSTALL_OVERRIDE_DIRS),$(TTT)="$(DESTDIR)$($(TTT))") -C $(OBJDIR) $(INSTALL_ARGS) install |
| 1052 |
@$(MAKECOOKIE) |
| 1053 |
|
| 1054 |
# Ruby makefiles |
| 1055 |
install-%/Rakefile: |
| 1056 |
@echo " ==> Running rake install in $*" |
| 1057 |
@( cd $* ; $(INSTALL_ENV) rake $(RAKEFLAGS) $(INSTALL_ARGS) ) |
| 1058 |
@$(MAKECOOKIE) |
| 1059 |
|
| 1060 |
install-%/rakefile: |
| 1061 |
@echo " ==> Running rake install in $*" |
| 1062 |
@( cd $* ; $(INSTALL_ENV) rake $(RAKEFLAGS) $(INSTALL_ARGS) ) |
| 1063 |
@$(MAKECOOKIE) |
| 1064 |
|
| 1065 |
install-%/setup.rb: |
| 1066 |
@echo " ==> Running setup.rb install in $*" |
| 1067 |
@( cd $* ; $(INSTALL_ENV) ruby ./setup.rb install --prefix=$(DESTDIR) ) |
| 1068 |
@$(MAKECOOKIE) |
| 1069 |
|
| 1070 |
# WAF build, for details see http://code.google.com/p/waf/ |
| 1071 |
install-%/waf: |
| 1072 |
@echo " ==> Running waf install in $*" |
| 1073 |
@$(cd $* ; (INSTALL_ENV) ./waf install $(INSTALL_ARGS) ) |
| 1074 |
@$(MAKECOOKIE) |
| 1075 |
|
| 1076 |
# This can be: install, install_lib, install_headers, install_scripts, |
| 1077 |
# or install_data. See setup.py --help-commands for details. |
| 1078 |
PYINSTALL_CMD ?= install |
| 1079 |
install-%/setup.py: |
| 1080 |
@echo " ==> Running setup.py $(PYINSTALL_CMD) in $*" |
| 1081 |
@( cd $* ; $(INSTALL_ENV) $(PYTHON_EXECUTABLE) ./setup.py $(PYINSTALL_CMD) $(INSTALL_ARGS) ) |
| 1082 |
@$(MAKECOOKIE) |
| 1083 |
|
| 1084 |
# pkg-config scripts |
| 1085 |
install-%-config: |
| 1086 |
mkdir -p $(STAGINGDIR)/$(NAME) |
| 1087 |
cp -f $(DESTDIR)$(bindir)/$*-config $(STAGINGDIR)/$(NAME)/ |
| 1088 |
$(MAKECOOKIE) |
| 1089 |
|
| 1090 |
###################################### |
| 1091 |
# Use a manifest file of the format: |
| 1092 |
# src:dest[:mode[:owner[:group]]] |
| 1093 |
# as in... |
| 1094 |
# ${WORKSRC}/nwall:${bindir}/nwall:2755:root:tty |
| 1095 |
# ${WORKSRC}/src/foo:${sharedstatedir}/foo |
| 1096 |
# ${WORKSRC}/yoink:${sysconfdir}/yoink:0600 |
| 1097 |
|
| 1098 |
# Okay, so for the benefit of future generations, this is how it |
| 1099 |
# works: |
| 1100 |
# |
| 1101 |
# First of all, we have this file with colon-separated lines. |
| 1102 |
# The $(shell cat foo) routine turns it into a space-separated |
| 1103 |
# list of words. The foreach iterates over this list, putting a |
| 1104 |
# colon-separated record in $(ZORCH) on each pass through. |
| 1105 |
# |
| 1106 |
# Next, we have the macro $(MANIFEST_LINE), which splits a record |
| 1107 |
# into a space-separated list, and $(MANIFEST_SIZE), which |
| 1108 |
# determines how many elements are in such a list. These are |
| 1109 |
# purely for convenience, and could be inserted inline if need |
| 1110 |
# be. |
| 1111 |
MANIFEST_LINE = $(subst :, ,$(ZORCH)) |
| 1112 |
MANIFEST_SIZE = $(words $(MANIFEST_LINE)) |
| 1113 |
|
| 1114 |
# So the install command takes a variable number of parameters, |
| 1115 |
# and our records have from two to five elements. Gmake can't do |
| 1116 |
# any sort of arithmetic, so we can't do any really intelligent |
| 1117 |
# indexing into the list of parameters. |
| 1118 |
# |
| 1119 |
# Since the last three elements of the $(MANIFEST_LINE) are what |
| 1120 |
# we're interested in, we make a parallel list with the parameter |
| 1121 |
# switch text (note the dummy elements at the beginning): |
| 1122 |
MANIFEST_FLAGS = notused notused --mode= --owner= --group= |
| 1123 |
|
| 1124 |
# The following environment variables are set before the |
| 1125 |
# installation boogaloo begins. This ensures that WORKSRC is |
| 1126 |
# available to the manifest and that all of the location |
| 1127 |
# variables are suitable for *installation* (that is, using |
| 1128 |
# DESTDIR) |
| 1129 |
|
| 1130 |
MANIFEST_ENV += WORKSRC=$(WORKSRC) |
| 1131 |
# This was part of the "implicit DESTDIR" regime. However: |
| 1132 |
# http://gar.lnx-bbc.org/wiki/ImplicitDestdirConsideredHarmful |
| 1133 |
#MANIFEST_ENV += $(foreach TTT,prefix exec_prefix bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir infodir lispdir includedir mandir,$(TTT)=$(DESTDIR)$($(TTT))) |
| 1134 |
|
| 1135 |
# ...and then we join a slice of it with the corresponding slice |
| 1136 |
# of the $(MANIFEST_LINE), starting at 3 and going to |
| 1137 |
# $(MANIFEST_SIZE). That's where all the real magic happens, |
| 1138 |
# right there! |
| 1139 |
# |
| 1140 |
# following that, we just splat elements one and two of |
| 1141 |
# $(MANIFEST_LINE) on the end, since they're the ones that are |
| 1142 |
# always there. Slap a semicolon on the end, and you've got a |
| 1143 |
# completed iteration through the foreach! Beaujolais! |
| 1144 |
|
| 1145 |
# FIXME: using -D may not be the right thing to do! |
| 1146 |
install-$(MANIFEST_FILE): |
| 1147 |
@echo " ==> Installing from $(MANIFEST_FILE)" |
| 1148 |
$(MANIFEST_ENV) ; $(foreach ZORCH,$(shell cat $(MANIFEST_FILE)), ginstall -Dc $(join $(wordlist 3,$(MANIFEST_SIZE),$(MANIFEST_FLAGS)),$(wordlist 3,$(MANIFEST_SIZE),$(MANIFEST_LINE))) $(word 1,$(MANIFEST_LINE)) $(word 2,$(MANIFEST_LINE)) ;) |
| 1149 |
@$(MAKECOOKIE) |
| 1150 |
|
| 1151 |
#################### DEPENDENCY RULES #################### |
| 1152 |
|
| 1153 |
# These two lines are here to grandfather in all the packages that use |
| 1154 |
# BUILDDEPS |
| 1155 |
IMGDEPS += build |
| 1156 |
build_DEPENDS = $(BUILDDEPS) |
| 1157 |
|
| 1158 |
# Standard deps install into the standard install dir. For the |
| 1159 |
# BBC, we set the includedir to the build tree and the libdir to |
| 1160 |
# the install tree. Most dependencies work this way. |
| 1161 |
|
| 1162 |
$(GARDIR)/%/$(COOKIEDIR)/install: |
| 1163 |
@echo ' ==> Building $* as a dependency' |
| 1164 |
@$(MAKE) -C $(GARDIR)/$* install DESTIMG=$(DESTIMG) |
| 1165 |
|
| 1166 |
# builddeps need to have everything put in the build DESTIMG |
| 1167 |
#$(GARDIR)/%/$(COOKIEROOTDIR)/build.d/install: |
| 1168 |
# @echo ' ==> Building $* as a build dependency' |
| 1169 |
# @$(MAKE) -C $(GARDIR)/$* install DESTIMG=build |
| 1170 |
|
| 1171 |
# Source Deps grab the source code for another package |
| 1172 |
# XXX: nobody uses this, but it should really be more like |
| 1173 |
# $(GARDIR)/%/cookies/patch: |
| 1174 |
srcdep-$(GARDIR)/%: |
| 1175 |
@echo ' ==> Grabbing source for $* as a dependency' |
| 1176 |
@$(MAKE) -C $(GARDIR)/$* patch-p extract-p > /dev/null 2>&1 || \ |
| 1177 |
$(MAKE) -C $(GARDIR)/$* patch |
| 1178 |
|
| 1179 |
# Image deps create dependencies on package installations in |
| 1180 |
# images other than the current package's DESTIMG. |
| 1181 |
IMGDEP_TARGETS = $(foreach TTT,$($*_DEPENDS),$(subst xyzzy,$(TTT),$(GARDIR)/xyzzy/$(COOKIEROOTDIR)/$*.d/install)) |
| 1182 |
imgdep-%: |
| 1183 |
@test -z "$(strip $(IMGDEP_TARGETS))" || $(MAKE) DESTIMG="$*" $(IMGDEP_TARGETS) |
| 1184 |
|
| 1185 |
# Igor's info and man gzipper rule |
| 1186 |
gzip-info-man: gzip-info gzip-man |
| 1187 |
|
| 1188 |
gzip-info: |
| 1189 |
gfind $(DESTDIR) -type f -iname *.info* -not -iname *.gz | \ |
| 1190 |
gxargs -r gzip --force |
| 1191 |
|
| 1192 |
gzip-man: |
| 1193 |
gfind $(DESTDIR) -type f -iname *.[1-8] -size +2 -print | \ |
| 1194 |
gxargs -r gzip --force |
| 1195 |
|
| 1196 |
compile-elisp: |
| 1197 |
@(for d in $(ELISP_DIRS); do \ |
| 1198 |
echo " ===> Compiling .el files in $$d"; \ |
| 1199 |
cd $(PKGROOT)/$$d; \ |
| 1200 |
for f in `find . -name "*el"`; do \ |
| 1201 |
bf=`basename $$f`; \ |
| 1202 |
bd=`dirname $$f`; \ |
| 1203 |
cd $$bd; \ |
| 1204 |
emacs -L $(PKGROOT)/$$d -L $(PKGROOT)/$$d/$$bd $(EXTRA_EMACS_ARGS) -batch -f batch-byte-compile "$$bf"; \ |
| 1205 |
cd $(PKGROOT)/$$d; \ |
| 1206 |
done; \ |
| 1207 |
done) |
| 1208 |
|
| 1209 |
include $(addprefix $(GARDIR)/,$(EXTRA_LIBS)) |
| 1210 |
|
| 1211 |
# Mmm, yesssss. cookies my preciousssss! Mmm, yes downloads it |
| 1212 |
# is! We mustn't have nasty little gmakeses deleting our |
| 1213 |
# precious cookieses now must we? |
| 1214 |
.PRECIOUS: $(DOWNLOADDIR)/% $(COOKIEDIR)/% $(FILEDIR)/% |