-
Notifications
You must be signed in to change notification settings - Fork 0
/
gar.lib.mk
1178 lines (999 loc) · 43.9 KB
/
gar.lib.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# vim: ft=make ts=4 sw=4 noet
#
# $Id$
#
# Copyright (C) 2001 Nick Moffitt
#
# Redistribution and/or use, with or without modification, is
# permitted. This software is without warranty of any kind. The
# author(s) shall not be liable in the event that use of the
# software causes damage.
#
# cookies go here, so we have to be able to find them for
# dependency checking.
VPATH += $(COOKIEDIR)
# convenience variable to make the cookie.
MAKECOOKIE = mkdir -p $(COOKIEDIR)/$(@D) && date >> $(COOKIEDIR)/$@
URLSTRIP = $(subst ://,//,$(1))
# if you need to proxy git:// connections, set GIT_USE_PROXY. There is a
# default proxy script that works with the (squid?) proxy at the BO buildfarm.
# override GIT_PROXY_SCRIPT to something else if you need to.
GIT_MAYBEPROXY = $(if $(GIT_USE_PROXY),GIT_PROXY_COMMAND=$(GIT_PROXY_SCRIPT))
GIT_TREEISH = $(if $(GIT_TREEISH_$(1)),$(GIT_TREEISH_$(1)),HEAD)
#################### FETCH RULES ####################
# if the caller has defined _postinstall, etc targets for a package,
# add these 'dynamic script' targets to our fetch list
DYNURLS := $(foreach DYN,$(DYNSCRIPTS),dynscr://$(DYN))
$(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))))
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)))) $(DYNURLS)
define gitsubst
$(subst git-git,git,$(if $(findstring $(1)://,$(2)),$(patsubst $(1)%,git-$(1)%,$(call URLSTRIP,$(2)))))
endef
ifdef GIT_REPOS
URLS += $(foreach R,$(GIT_REPOS),gitrepo://$(call GITPROJ,$(R)) $(foreach gitproto,git http file ssh,$(call gitsubst,$(gitproto),$(R))))
endif
# Download the file if and only if it doesn't have a preexisting
# checksum file. Loop through available URLs and stop when you
# get one that doesn't return an error code.
# Note that GAR targets are used to download the URLs, thus:
# 1) we have to strip the colon from the URLs
# 2) the download is very costly with bigger Makefiles as they will be
# re-evaluated for every URL (nested gmake invocation, room for improvement)
$(DOWNLOADDIR)/%: _FLIST=$(filter %/$*,$(URLS)) $(foreach URL,$(URLS),$(if $(findstring $(GITHUB_HOST),$(URL)),$(URL),))
$(DOWNLOADDIR)/%:
$(if $(_FLIST),,$(error INTERNAL ERROR: The file $* is requested but not in the list of generated URLs))
@if test -f $(COOKIEDIR)/checksum-$*; then : ; else \
echo " ==> Grabbing $@"; \
( for i in $(filter %/$*,$(URLS)) $(foreach URL,$(URLS),$(if $(findstring $(GITHUB_HOST),$(URL)),$(URL),)); do \
echo " ==> Trying $$i"; \
$(MAKE) -s `echo $$i | tr -d :` || continue; \
case $$i in \
*$(GITHUB_HOST)*) \
mv $(PARTIALDIR)/$(GITHUB_REFERENCE) $@ ;; \
*) \
mv $(PARTIALDIR)/$* $@ ;; \
esac; \
break; \
done; ) 2>&1 | grep -v '^$(MAKE)'; \
if test -r $@ ; then : ; else \
echo '(!!!) Failed to download $@!' 1>&2; \
false; \
fi; \
fi
gitrepo//%:
@( if [ -d $(GARCHIVEDIR)/$(call GITPROJ,$*) ]; then \
( cd $(GARCHIVEDIR)/$(call GITPROJ,$*); \
$(GIT_MAYBEPROXY) git --bare fetch ) && \
gln -s $(GARCHIVEDIR)/$(call GITPROJ,$*)/ $(PARTIALDIR)/$(call GITPROJ,$*); \
else \
false; \
fi )
# the git remote add commands are so that we can later do a fetch
# to update the code.
# we possibly proxy the git:// references depending on GIT_USE_PROXY
git-http//%:
@git clone --bare http://$* $(PARTIALDIR)/$(call GITPROJ,$*)
@( cd $(PARTIALDIR)/$(call GITPROJ,$*); \
git config remote.origin.fetch $(if $(GIT_REFS_$(call GITPROJ,$*)),$(GIT_REFS_$(call GITPROJ,$*)),$(GIT_DEFAULT_TRACK)); )
git//%:
@$(GIT_MAYBEPROXY) git clone --bare git://$* $(PARTIALDIR)/$(call GITPROJ,$*)
@( cd $(PARTIALDIR)/$(call GITPROJ,$*); \
git config remote.origin.fetch $(if $(GIT_REFS_$(call GITPROJ,$*)),$(GIT_REFS_$(call GITPROJ,$*)),$(GIT_DEFAULT_TRACK)); )
git-file//%:
@git clone --bare file:///$* $(PARTIALDIR)/$(call GITPROJ,$*)
@( cd $(PARTIALDIR)/$(call GITPROJ,$*); \
git config remote.origin.fetch $(if $(GIT_REFS_$(call GITPROJ,$*)),$(GIT_REFS_$(call GITPROJ,$*)),$(GIT_DEFAULT_TRACK)); )
git-ssh//%:
@git clone --bare ssh://$* $(PARTIALDIR)/$(call GITPROJ,$*)
@( cd $(PARTIALDIR)/$(call GITPROJ,$*); \
git config remote.origin.fetch $(if $(GIT_REFS_$(call GITPROJ,$*)),$(GIT_REFS_$(call GITPROJ,$*)),$(GIT_DEFAULT_TRACK)); )
# create ADMSCRIPTS 'on the fly' from variables defined by the caller
# This version is private and should only be called from the non-private
# version directly below
_dynscr//%:
$($(subst .,_,$*))
dynscr//%:
$(MAKE) --no-print-directory -n _$@ > $(PARTIALDIR)/$*
# download an http URL (colons omitted)
http//%:
@wget $(WGET_OPTS) -T 30 -c -P $(PARTIALDIR) http://$*
https//%:
@wget $(WGET_OPTS) -T 30 -c -P $(PARTIALDIR) https://$*
# download an ftp URL (colons omitted)
#ftp//%:
# @wget -T 30 -c --passive-ftp -P $(PARTIALDIR) ftp://$*
ftp//%:
@wget $(WGET_OPTS) -T 30 -c -P $(PARTIALDIR) ftp://$*
# link to a local copy of the file
# (absolute path)
file///%:
@if test -f /$*; then \
gln -sf /$* $(PARTIALDIR)/$(notdir $*); \
else \
false; \
fi
# link to a local copy of the file
# (relative path)
file//%:
@if test -f $*; then \
gln -sf "$(CURDIR)/$*" $(PARTIALDIR)/$(notdir $*); \
else \
false; \
fi
# Using Jeff Waugh's rsync rule.
# DOES NOT PRESERVE SYMLINKS!
rsync//%:
@rsync -azvLP rsync://$* $(PARTIALDIR)/
# Using Jeff Waugh's scp rule
scp//%:
@scp -C $* $(PARTIALDIR)/
# Fetch a SVN repo via http
svn-http//%:
@svn co $(SVNHTTP_CO_ARGS) http://$* $(PARTIALDIR)/$(notdir $*)
svn-https//%:
@svn co $(SVNHTTP_CO_ARGS) https://$* $(PARTIALDIR)/$(notdir $*)
# Sometimes files must be downloaded manually (e.g. for license reasons)
manual//%:
@echo
@echo "Please download the file"
@echo " $*"
@echo "manually from"
@echo " $(SPKG_SOURCEURL)"
@echo "and copy it to"
@echo " $(GARCHIVEDIR)"
@echo
#################### CHECKSUM RULES ####################
# check a given file's checksum against $(CHECKSUM_FILE) and
# error out if it mentions the file without an "OK".
# The removal of the download prefix is for legacy checksums. For newstyle
# checksums without path this is not necessary.
checksum-%: $(CHECKSUM_FILE)
@echo " ==> Running checksum on $*"
@if ggrep -- '[ /]$*$$' $(CHECKSUM_FILE); then \
if cat $(CHECKSUM_FILE) | sed -e 's!download/!!' | (cd $(DOWNLOADDIR); LC_ALL="C" LANG="C" gmd5sum -c 2>&1) | \
ggrep -- '$*' | ggrep -v ':[ ]\+OK'; then \
echo '(!!!) $* failed checksum test!' 1>&2; \
false; \
else \
echo 'file $* passes checksum test!'; \
$(MAKECOOKIE); \
fi \
else \
echo '(!!!) $* not in $(CHECKSUM_FILE) file!' 1>&2; \
echo '(!!!) Maybe you need to run mgar makesum?' 1>&2; \
echo '(!!!) WARNING: This could also mean that you have downloaded broken or compromised archive' 1>&2; \
echo '(!!!) [Not likely but possible.]' 1>&2; \
false; \
fi
#################### CHECKNEW RULES ####################
################### UWATCH VARIABLES ###################
UPSTREAM_MASTER_SITES ?= $(MASTER_SITES)
ENABLE_UWATCH ?= 1
########################################################
# Display uwatch informations
#
get-uwatch-configuration:
@if [ '$(ENABLE_UWATCH)' -ne '1' ] ; then \
echo "$(NAME) - Upstream Watch is disabled" ; \
else \
echo "$(NAME) - Upstream Watch is enabled" ; \
if [ ! -n '$(CATALOGNAME)' ]; then \
echo "$(NAME) - CATALOGNAME is not set" ; \
else \
echo "$(NAME) - CATALOGNAME is : $(CATALOGNAME)" ; \
fi ; \
if [ ! -n '$(DISTFILES)' ]; then \
echo "$(NAME) - DISTFILES is not set" ; \
else \
echo "$(NAME) - DISTFILES are : $(DISTFILES)" ; \
fi ; \
if [ ! -n '$(UFILES_REGEX)' ]; then \
echo "$(NAME) - UFILES_REGEX is not set" ; \
else \
echo "$(NAME) - UFILES_REGEX is : $(UFILES_REGEX)" ; \
fi; \
if [ ! -n '$(UPSTREAM_MASTER_SITES)' ]; then \
echo "$(NAME) - UPSTREAM_MASTER_SITES is not set" ; \
else \
echo "$(NAME) - UPSTREAM_MASTER_SITES is : $(UPSTREAM_MASTER_SITES)" ; \
fi; \
if [ ! -n '$(VERSION)' ]; then \
echo "$(NAME) - VERSION is not set" ; \
else \
echo "$(NAME) - GAR version is : $(VERSION)" ; \
fi ; \
if [ ! -n '$(http_proxy)' ]; then \
echo "$(NAME) - http_proxy is not set" ; \
else \
echo "$(NAME) - http_proxy is : $(http_proxy)" ; \
fi ; \
if [ ! -n '$(ftp_proxy)' ]; then \
echo "$(NAME) - ftp_proxy is not set" ; \
else \
echo "$(NAME) - ftp_proxy is : $(ftp_proxy)" ; \
fi ; \
fi ;
########################################################
# Retrieve the list of upstream versions
#
get-upstream-version-list:
@if [ '$(ENABLE_UWATCH)' -ne '1' ] ; then \
echo "$(NAME) - Upstream Watch is disabled" ; \
else \
UWATCHCONFCHECK="Ok" ; \
if [ ! -n '$(UFILES_REGEX)' ]; then \
echo "$(NAME) - UFILES_REGEX is not set - trying to guess it" ; \
fi; \
if [ ! -n '$(UPSTREAM_MASTER_SITES)' ]; then \
echo "$(NAME) - Error UPSTREAM_MASTER_SITES is not set" ; \
UWATCHCONFCHECK="Error" ; \
fi; \
if [ ! -n '$(VERSION)' ]; then \
echo "$(NAME) - Error VERSION is not set" ; \
UWATCHCONFCHECK="Error" ; \
fi; \
if [ "$$UWATCHCONFCHECK" -ne "Ok" ] ; then \
exit 1 ; \
fi ; \
if [ ! -n '$(UFILES_REGEX)' ]; then \
VERSIONLIST=`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)"` ; \
else \
VERSIONLIST=`http_proxy=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/uwatch get-upstream-version-list --upstream-url="$(UPSTREAM_MASTER_SITES)" --regexp="$(UFILES_REGEX)"` ; \
fi ; \
if [ "$$?" -ne "0" ] ; then \
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 :" ; \
echo "Output : $$VERSIONLIST" ; \
exit 1 ; \
fi; \
if [ -n "$$VERSIONLIST" ] ; then \
for VERSION in $$VERSIONLIST ; do \
if [ ! "$$VERSION" -eq "" ] ; then \
echo "$(NAME) - $$VERSION" ; \
fi ; \
done ; \
else \
echo "$(NAME) - No version found. Please check UPSTREAM_MASTER_SITES and UFILES_REGEX variables in the Makefile" ; \
fi ; \
fi ;
########################################################
# Retrieve the newest upstream version
#
get-upstream-latest-version:
@if [ '$(ENABLE_UWATCH)' -ne '1' ] ; then \
echo "$(NAME) - Upstream Watch is disabled" ; \
else \
UWATCHCONFCHECK="Ok" ; \
if [ ! -n '$(UFILES_REGEX)' ]; then \
echo "$(NAME) - UFILES_REGEX is not set - trying to guess it" ; \
fi; \
if [ ! -n '$(UPSTREAM_MASTER_SITES)' ]; then \
echo "$(NAME) - Error UPSTREAM_MASTER_SITES is not set" ; \
UWATCHCONFCHECK="Error" ; \
fi; \
if [ ! -n '$(VERSION)' ]; then \
echo "$(NAME) - Error VERSION is not set" ; \
UWATCHCONFCHECK="Error" ; \
fi; \
if [ "$$UWATCHCONFCHECK" -ne "Ok" ] ; then \
exit 1 ; \
fi ; \
if [ ! -n '$(UFILES_REGEX)' ]; then \
LATEST=`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)"` ; \
else \
LATEST=`http_proxy=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/uwatch get-upstream-latest-version --upstream-url="$(UPSTREAM_MASTER_SITES)" --regexp="$(UFILES_REGEX)"` ; \
fi ; \
if [ "$$?" -ne "0" ] ; then \
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 :" ; \
echo "$$LATEST" ; \
exit 1 ; \
fi; \
if [ -n "$$LATEST" ] ; then \
echo "$(NAME) - Latest upstream version is $$LATEST" ; \
else \
echo "$(NAME) - No version found. Please check UPSTREAM_MASTER_SITES and UFILES_REGEX variables in the Makefile" ; \
fi ; \
fi ;
########################################################
# Compare local and upstream versions
#
check-upstream:
@if [ '$(ENABLE_UWATCH)' -ne '1' ] ; then \
echo "$(NAME) - Upstream Watch is disabled" ; \
else \
UWATCHCONFCHECK="Ok" ; \
if [ ! -n '$(UFILES_REGEX)' ]; then \
echo "$(NAME) - UFILES_REGEX is not set - trying to guess it" ; \
fi; \
if [ ! -n '$(UPSTREAM_MASTER_SITES)' ]; then \
echo "$(NAME) - Error UPSTREAM_MASTER_SITES is not set" ; \
UWATCHCONFCHECK="Error" ; \
fi; \
if [ ! -n '$(VERSION)' ]; then \
echo "$(NAME) - Error VERSION is not set" ; \
UWATCHCONFCHECK="Error" ; \
fi; \
if [ "$$UWATCHCONFCHECK" -ne "Ok" ] ; then \
exit 1 ; \
fi ; \
if [ ! -n '$(UFILES_REGEX)' ]; then \
LATEST=`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)"` ; \
else \
LATEST=`http_proxy=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/uwatch check-upstream --upstream-url="$(UPSTREAM_MASTER_SITES)" --regexp="$(UFILES_REGEX)" --current-version="$(VERSION)"` ; \
fi ; \
if [ "$$?" -ne "0" ] ; then \
echo "Error occured while executing uwatch check-upstream. Please check configuration with target get-uwatch-configuration. Here is the output of uwatch command :" ; \
echo "$$LATEST" ; \
exit 1 ; \
fi; \
if [ -n "$$LATEST" ] ; then \
echo "$(NAME) : A new version of upstream files is available. Package can be upgraded from version $(VERSION) to $$LATEST"; \
else \
echo "$(NAME) : Package is up-to-date. Current version is $(VERSION)" ; \
fi ; \
fi
########################################################
# Create upgrade branch from current to latest upstream
#
upgrade-to-latest-upstream:
@if [ '$(ENABLE_UWATCH)' -ne '1' ] ; then \
echo "$(NAME) - Upstream Watch is disabled" ; \
else \
UWATCHCONFCHECK="Ok" ; \
if [ ! -n '$(UFILES_REGEX)' ]; then \
echo "$(NAME) - UFILES_REGEX is not set - trying to guess it" ; \
fi; \
if [ ! -n '$(UPSTREAM_MASTER_SITES)' ]; then \
echo "$(NAME) - Error UPSTREAM_MASTER_SITES is not set" ; \
UWATCHCONFCHECK="Error" ; \
fi; \
if [ ! -n '$(VERSION)' ]; then \
echo "$(NAME) - Error VERSION is not set" ; \
UWATCHCONFCHECK="Error" ; \
fi; \
if [ "$$UWATCHCONFCHECK" -ne "Ok" ] ; then \
exit 1 ; \
fi ; \
if [ ! -n '$(UFILES_REGEX)' ]; then \
LATEST=`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)"` ; \
else \
LATEST=`http_proxy=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/uwatch check-upstream --upstream-url="$(UPSTREAM_MASTER_SITES)" --regexp="$(UFILES_REGEX)" --current-version="$(VERSION)"` ; \
fi ; \
if [ "$$?" -ne "0" ] ; then \
echo "Error occured while executing uwatch check-upstream. Please check configuration with target get-uwatch-configuration. Here is the output of uwatch command :" ; \
echo "$$LATEST" ; \
exit 1 ; \
fi; \
if [ ! -f "$(COOKIEDIR)/upgrade-to-latest-upstream-$$LATEST" ] ; then \
if [ ! -d "../branches/upgrade_from_$(VERSION)_to_$$LATEST" ] ; then \
if [ -n "$$LATEST" ] ; then \
echo "$(NAME) : a new version of upstream files is available. Creating upgrade branch from version $(VERSION) to $$LATEST"; \
VERSIONUPGRADE=`http_proxy=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/uwatch upgrade-to-version --current-version="$(VERSION)" --target-version="$$LATEST"` ; \
if [ "$$?" -ne "0" ] ; then \
echo "Error occured while executing uwatch upgrade-to-version. Please check configuration with target get-uwatch-configuration. Here is the output of uwatch command :" ; \
echo "$$VERSIONUPGRADE" ; \
exit 1 ; \
fi; \
if [ -n "$$VERSIONUPGRADE" ] ; then \
echo "$(NAME) - $$VERSIONUPGRADE" ; \
fi ; \
else \
echo "$(NAME) : Package is up-to-date. Upstream site has no version newer than $(VERSION)" ; \
fi ; \
else \
echo "$(NAME) - Upgrade branch from version $(VERSION) to version $$LATEST already exist" ; \
fi ; \
$(MAKE) upgrade-to-latest-upstream-$$LATEST >/dev/null; \
else \
echo "$(NAME) - Upgrade branch to version $$LATEST already created by upstream_watch" ; \
fi ; \
fi
########################################################
# Create upgrade branch from current to latest upstream
#
update-package-version-database:PACKAGELIST=$(foreach SPEC,$(SPKG_SPECS),$(call _pkglist_one,$(SPEC))\n)
update-package-version-database:
@EXECUTIONDATE=`date +"%Y-%m-%d %H:%M:%S"` ; \
if [ '$(ENABLE_UWATCH)' -ne '1' ] ; then \
echo "$(NAME) - Upstream Watch is disabled" ; \
printf "$(PACKAGELIST)" | while read line ; do \
GARPATH=`echo $$line | awk '{ print $$1 }'` ; \
CATALOGNAME=`echo $$line | awk '{ print $$2 }'` ; \
PKGNAME=`echo $$line | awk '{ print $$3 }'` ; \
REPORTVERSION=`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` ; \
if [ "$$?" -ne "0" ] ; then \
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 :" ; \
echo "$$REPORTVERSION" ; \
exit 1 ; \
fi; \
done ; \
if [ -n "$$REPORTVERSION" ] ; then \
echo "$(NAME) - $$REPORTVERSION" ; \
fi ; \
else \
UWATCHCONFCHECK="Ok" ; \
if [ ! -n '$(UFILES_REGEX)' ]; then \
echo "$(NAME) - UFILES_REGEX is not set - trying to guess it" ; \
fi; \
if [ ! -n '$(UPSTREAM_MASTER_SITES)' ]; then \
echo "$(NAME) - Error UPSTREAM_MASTER_SITES is not set" ; \
UWATCHCONFCHECK="Error" ; \
fi; \
if [ ! -n '$(VERSION)' ]; then \
echo "$(NAME) - Error VERSION is not set" ; \
UWATCHCONFCHECK="Error" ; \
fi; \
if [ "$$UWATCHCONFCHECK" -ne "Ok" ] ; then \
printf "$(PACKAGELIST)" | while read line ; do \
GARPATH=`echo $$line | awk '{ print $$1 }'` ; \
CATALOGNAME=`echo $$line | awk '{ print $$2 }'` ; \
PKGNAME=`echo $$line | awk '{ print $$3 }'` ; \
REPORTVERSION=`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" ` ; \
if [ "$$?" -ne "0" ] ; then \
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 :" ; \
echo "$$REPORTVERSION" ; \
exit 1 ; \
fi; \
done ; \
exit 1 ; \
fi ; \
if [ ! -n '$(UFILES_REGEX)' ]; then \
LATEST=`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)"` ; \
else \
LATEST=`http_proxy=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/uwatch get-upstream-latest-version --upstream-url="$(UPSTREAM_MASTER_SITES)" --regexp="$(UFILES_REGEX)"` ; \
fi ; \
if [ "$$?" -ne "0" ] ; then \
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 :" ; \
echo "$$LATEST" ; \
printf "$(PACKAGELIST)" | while read line ; do \
GARPATH=`echo $$line | awk '{ print $$1 }'` ; \
CATALOGNAME=`echo $$line | awk '{ print $$2 }'` ; \
PKGNAME=`echo $$line | awk '{ print $$3 }'` ; \
REPORTVERSION=`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" ` ; \
if [ "$$?" -ne "0" ] ; then \
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 :" ; \
echo "$$REPORTVERSION" ; \
exit 1 ; \
fi; \
done ; \
exit 1 ; \
fi; \
printf "$(PACKAGELIST)" | while read line ; do \
GARPATH=`echo $$line | awk '{ print $$1 }'` ; \
CATALOGNAME=`echo $$line | awk '{ print $$2 }'` ; \
PKGNAME=`echo $$line | awk '{ print $$3 }'` ; \
if [ ! -n '$(UFILES_REGEX)' ]; then \
REPORTVERSION=`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" ` ; \
else \
REPORTVERSION=`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" ` ; \
fi ; \
if [ "$$?" -ne "0" ] ; then \
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 :" ; \
echo "$$REPORTVERSION" ; \
REPORTVERSION=`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" ` ; \
if [ "$$?" -ne "0" ] ; then \
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 :" ; \
echo "$$REPORTVERSION" ; \
exit 1 ; \
fi; \
exit 1 ; \
fi; \
done ; \
if [ -n "$$REPORTVERSION" ] ; then \
echo "$(NAME) - $$REPORTVERSION" ; \
fi ; \
fi
#
########################################################
#
get-gar-version:
@if [ ! -n '$(VERSION)' ]; then \
echo "$(NAME) - VERSION is not defined" ; \
exit 1 ; \
else \
echo "$(NAME) - GAR version is $(VERSION)" ; \
fi ;
upgrade-to-latest-upstream-%:
@$(MAKECOOKIE)
#################### GARCHIVE RULES ####################
# while we're here, let's just handle how to back up our
# checksummed files
$(GARCHIVEDIR)/%: $(GARCHIVEDIR)
@if [ -h $(DOWNLOADDIR)/$* ]; then :; else \
gcp -Lr $(DOWNLOADDIR)/$* $@; \
fi
#################### EXTRACT RULES ####################
TAR_ARGS = --no-same-owner
# rule to extract uncompressed tarballs
tar-extract-%:
@echo " ==> Extracting $(DOWNLOADDIR)/$*"
@gtar $(TAR_ARGS) -xf $(DOWNLOADDIR)/$* -C $(EXTRACTDIR)
@$(MAKECOOKIE)
# rule to extract files with tar xzf
tar-gz-extract-%:
@echo " ==> Extracting $(DOWNLOADDIR)/$*"
@gzip -dc $(DOWNLOADDIR)/$* | gtar $(TAR_ARGS) -xf - -C $(EXTRACTDIR)
@$(MAKECOOKIE)
# rule to extract files with tar and bzip
tar-bz-extract-%:
@echo " ==> Extracting $(DOWNLOADDIR)/$*"
@bzip2 -dc $(DOWNLOADDIR)/$* | gtar $(TAR_ARGS) -xf - -C $(EXTRACTDIR)
@$(MAKECOOKIE)
# rule to extract files with tar and xz
tar-xz-extract-%:
@echo " ==> Extracting $(DOWNLOADDIR)/$*"
@xz -dc $(DOWNLOADDIR)/$* | gtar $(TAR_ARGS) -xf - -C $(EXTRACTDIR)
@$(MAKECOOKIE)
# rule to extract files with tar and lz
tar-lz-extract-%:
@echo " ==> Extracting $(DOWNLOADDIR)/$*"
@lzip -dc $(DOWNLOADDIR)/$* | gtar $(TAR_ARGS) -xf - -C $(EXTRACTDIR)
@$(MAKECOOKIE)
# rule to extract files with tar and lzma
tar-lzma-extract-%:
@echo " ==> Extracting $(DOWNLOADDIR)/$*"
@lzma -dc $(DOWNLOADDIR)/$* | gtar $(TAR_ARGS) -xf - -C $(EXTRACTDIR)
@$(MAKECOOKIE)
# extract compressed single files
gz-extract-%:
@echo " ==> Decompressing $(DOWNLOADDIR)/$*"
@cp $(DOWNLOADDIR)/$* $(WORKDIR)/
@gzip -d $(WORKDIR)/$*
@$(MAKECOOKIE)
gz-extract-%:
@echo " ==> Decompressing $(DOWNLOADDIR)/$*"
@cp $(DOWNLOADDIR)/$* $(WORKDIR)/
@gzip -d $(WORKDIR)/$*
@$(MAKECOOKIE)
xz-extract-%:
@echo " ==> Decompressing $(DOWNLOADDIR)/$*"
@cp $(DOWNLOADDIR)/$* $(WORKDIR)/
@xz -d $(WORKDIR)/$*
@$(MAKECOOKIE)
lz-extract-%:
@echo " ==> Decompressing $(DOWNLOADDIR)/$*"
@cp $(DOWNLOADDIR)/$* $(WORKDIR)/
@lzip -d $(WORKDIR)/$*
@$(MAKECOOKIE)
lzma-extract-%:
@echo " ==> Decompressing $(DOWNLOADDIR)/$*"
@cp $(DOWNLOADDIR)/$* $(WORKDIR)/
@lzma -d $(WORKDIR)/$*
@$(MAKECOOKIE)
# extra dependency rule for git repos, that will allow the user
# to supply an alternate target at their discretion
git-extract-%:
@echo " ===> Extracting Git Repo $(DOWNLOADDIR)/$* (Treeish: $(call GIT_TREEISH,$*))"
( cd $(abspath $(DOWNLOADDIR))/$*/; git --bare archive --prefix=$(NAME)-$(VERSION)/ $(call GIT_TREEISH,$*)) | gtar -xf - -C $(EXTRACTDIR)
@$(MAKECOOKIE)
# rule to extract files with unzip
zip-extract-%:
@echo " ==> Extracting $(DOWNLOADDIR)/$*"
@unzip $(DOWNLOADDIR)/$* -d $(EXTRACTDIR)
@$(MAKECOOKIE)
# this is a null extract rule for files which are constant and
# unchanged (not archives)
cp-extract-%:
@echo " ==> Copying $(DOWNLOADDIR)/$*"
@# Make sure to keep symlinks and don't traverse recursive ones
@(cd $(DOWNLOADDIR); gtar cf - $*) | (cd $(WORKDIR); gtar xf -)
@$(MAKECOOKIE)
#gets the meat of a .deb into $(WORKSRC)
deb-bin-extract-%:
@echo " ==> Extracting $(DOWNLOADDIR)/$*"
@ar x $(DOWNLOADDIR)/$*
@rm debian-binary && \
mv *.tar.gz $(DOWNLOADDIR) && \
mkdir $(WORKSRC) && \
gtar $(TAR_ARGS) -xvz -C $(WORKSRC) \
-f $(DOWNLOADDIR)/data.tar.gz
@$(MAKECOOKIE)
### EXTRACT FILE TYPE MAPPINGS ###
# These rules specify which of the above extract action rules to use for a
# given file extension. Often support for a given extract type can be handled
# by simply adding a rule here.
extract-archive-%.tar: tar-extract-%.tar
@$(MAKECOOKIE)
extract-archive-%.tar.gz: tar-gz-extract-%.tar.gz
@$(MAKECOOKIE)
extract-archive-%.tar.Z: tar-gz-extract-%.tar.Z
@$(MAKECOOKIE)
extract-archive-%.tgz: tar-gz-extract-%.tgz
@$(MAKECOOKIE)
extract-archive-%.taz: tar-gz-extract-%.taz
@$(MAKECOOKIE)
extract-archive-%.tar.bz: tar-bz-extract-%.tar.bz
@$(MAKECOOKIE)
extract-archive-%.tar.bz2: tar-bz-extract-%.tar.bz2
@$(MAKECOOKIE)
extract-archive-%.tbz: tar-bz-extract-%.tbz
@$(MAKECOOKIE)
extract-archive-%.tar.xz: tar-xz-extract-%.tar.xz
@$(MAKECOOKIE)
extract-archive-%.tar.lz: tar-lz-extract-%.tar.lz
@$(MAKECOOKIE)
extract-archive-%.tar.lzma: tar-lzma-extract-%.tar.lzma
@$(MAKECOOKIE)
extract-archive-%.zip: zip-extract-%.zip
@$(MAKECOOKIE)
extract-archive-%.ZIP: zip-extract-%.ZIP
@$(MAKECOOKIE)
extract-archive-%.deb: deb-bin-extract-%.deb
@$(MAKECOOKIE)
extract-archive-%.gz: gz-extract-%.gz
@$(MAKECOOKIE)
extract-archive-%.bz2: bz-extract-%.bz2
@$(MAKECOOKIE)
extract-archive-%.xz: xz-extract-%.xz
@$(MAKECOOKIE)
extract-archive-%.lz: lz-extract-%.lz
@$(MAKECOOKIE)
extract-archive-%.lzma: lzma-extract-%.lzma
@$(MAKECOOKIE)
extract-archive-%.git: git-extract-%.git
@$(MAKECOOKIE)
extract-copy-%: cp-extract-%
@$(MAKECOOKIE)
# anything we don't know about, we just assume is already
# uncompressed and unarchived in plain format
extract-archive-%: cp-extract-%
@$(MAKECOOKIE)
#################### PATCH RULES ####################
PATCHDIR ?= $(WORKDIR)/$(DISTNAME)
PATCHDIRLEVEL ?= 1
PATCHDIRFUZZ ?= 2
GARPATCH = gpatch -d$(PATCHDIR) -p$(PATCHDIRLEVEL) -F$(PATCHDIRFUZZ)
BASEWORKSRC = $(shell basename $(WORKSRC))
# apply xzipped patches
xz-patch-%:
@echo " ==> Applying patch $(DOWNLOADDIR)/$*"
@xz -dc $(DOWNLOADDIR)/$* | $(GARPATCH) || exit 1
@( if [ -z "$(NOGITPATCH)" ]; then \
cd $(PATCHDIR); git add -A; \
git commit -am "old xz-style patch: $*"; \
fi )
@$(MAKECOOKIE)
# apply bzipped patches
bz-patch-%:
@echo " ==> Applying patch $(DOWNLOADDIR)/$*"
@bzip2 -dc $(DOWNLOADDIR)/$* | $(GARPATCH) || exit 1
@( if [ -z "$(NOGITPATCH)" ]; then \
cd $(PATCHDIR); git add -A; \
git commit -am "old bz-style patch: $*"; \
fi )
@$(MAKECOOKIE)
# apply gzipped patches
gz-patch-%:
@echo " ==> Applying patch $(DOWNLOADDIR)/$*"
@gzip -dc $(DOWNLOADDIR)/$* | $(GARPATCH) || exit 1
@( if [ -z "$(NOGITPATCH)" ]; then \
cd $(PATCHDIR); git add -A; \
git commit -am "old gz-style patch: $*"; \
fi )
@$(MAKECOOKIE)
# apply normal patches (git format-patch output or old-style diff -r)
normal-patch-%:
@echo " ==> Applying patch $(DOWNLOADDIR)/$*"
@( if ggrep -q 'diff --git' $(abspath $(DOWNLOADDIR)/$*); then \
if [ -z "$(NOGITPATCH)" ]; then \
cd $(PATCHDIR);\
git am --ignore-space-change --ignore-whitespace $(abspath $(DOWNLOADDIR)/$*) || exit 1; \
else \
$(GARPATCH) < $(DOWNLOADDIR)/$* || exit 1; \
fi; \
else \
echo Adding old-style patch...; \
$(GARPATCH) < $(DOWNLOADDIR)/$* || exit 1; \
if [ -z "$(NOGITPATCH)" ]; then \
cd $(PATCHDIR); \
git add -A; \
git commit -am "old style patch: $*"; \
fi; \
fi )
@$(MAKECOOKIE)
### PATCH FILE TYPE MAPPINGS ###
# These rules specify which of the above patch action rules to use for a given
# file extension. Often support for a given patch format can be handled by
# simply adding a rule here.
patch-extract-%.xz: xz-patch-%.xz
@$(MAKECOOKIE)
patch-extract-%.bz: bz-patch-%.bz
@$(MAKECOOKIE)
patch-extract-%.bz2: bz-patch-%.bz2
@$(MAKECOOKIE)
patch-extract-%.gz: gz-patch-%.gz
@$(MAKECOOKIE)
patch-extract-%.Z: gz-patch-%.Z
@$(MAKECOOKIE)
patch-extract-%.diff: normal-patch-%.diff
@$(MAKECOOKIE)
patch-extract-%.patch: normal-patch-%.patch
@$(MAKECOOKIE)
patch-extract-%: normal-patch-%
@$(MAKECOOKIE)
#################### CONFIGURE RULES ####################
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)
NODIRPATHS += --lispdir
DIRPATHS = $(filter-out $(addsuffix %,$(NODIRPATHS)), $(TMP_DIRPATHS))
CONFIGURE_ARGS ?= $(DIRPATHS) $(EXTRA_CONFIGURE_ARGS)
# configure a package that has an autoconf-style configure
# script.
configure-%/configure:
@echo " ==> Running configure in $*"
cd $* && mkdir -p $(OBJDIR) && cd $(OBJDIR) && /usr/bin/env -i $(CONFIGURE_ENV) $(abspath $*)/configure $(CONFIGURE_ARGS)
@$(MAKECOOKIE)
configure-%/autogen.sh:
@echo " ==> Running autogen.sh in $*"
cd $* && mkdir -p $(OBJDIR) && cd $(OBJDIR) && $(CONFIGURE_ENV) $(abspath $*)/autogen.sh $(CONFIGURE_ARGS)
@$(MAKECOOKIE)
# configure a package that uses imake
# FIXME: untested and likely not the right way to handle the
# arguments
configure-%/Imakefile:
@echo " ==> Running xmkmf in $*"
@cd $* && $(CONFIGURE_ENV) xmkmf $(CONFIGURE_ARGS)
@$(MAKECOOKIE)
configure-%/setup.rb:
@echo " ==> Running setup.rb config in $*"
@( cd $* ; $(CONFIGURE_ENV) ruby ./setup.rb config $(CONFIGURE_ARGS) )
@$(MAKECOOKIE)
# WAF build, for details see http://code.google.com/p/waf/
configure-%/waf:
@echo " ==> Running waf configure in $*"
cd $* && $(CONFIGURE_ENV) ./waf configure $(CONFIGURE_ARGS)
@$(MAKECOOKIE)
PYCONFIGURE_CMD = config
configure-%/setup.py:
@echo " ==> Running setup.py $(PYBUILD_TYPE) in $*"
@( cd $* ; $(BUILD_ENV) $(PYTHON_EXECUTABLE) ./setup.py $(PYCONFIGURE_CMD) $(CONFIGURE_ARGS) )
@$(MAKECOOKIE)
#################### BUILD RULES ####################
# build from a standard gnu-style makefile's default rule.
build-%/Makefile:
@echo " ==> Running make in $*"
cd $* && /usr/bin/env -i $(BUILD_ENV) $(MAKE) MAKEFLAGS= $(PARALLELMFLAGS) $(foreach TTT,$(BUILD_OVERRIDE_VARS),$(TTT)="$(BUILD_OVERRIDE_VAR_$(TTT))") $(foreach TTT,$(BUILD_OVERRIDE_DIRS),$(TTT)="$($(TTT))") -C $(OBJDIR) $(BUILD_ARGS)
@$(MAKECOOKIE)
build-%/makefile:
@echo " ==> Running make in $*"
cd $* && /usr/bin/env -i $(BUILD_ENV) $(MAKE) MAKEFLAGS= $(PARALLELMFLAGS) $(foreach TTT,$(BUILD_OVERRIDE_VARS),$(TTT)="$(BUILD_OVERRIDE_VAR_$(TTT))") $(foreach TTT,$(BUILD_OVERRIDE_DIRS),$(TTT)="$($(TTT))") -C $(OBJDIR) $(BUILD_ARGS)
@$(MAKECOOKIE)
build-%/GNUmakefile:
@echo " ==> Running make in $*"
cd $* && /usr/bin/env -i $(BUILD_ENV) $(MAKE) MAKEFLAGS= $(PARALLELMFLAGS) $(foreach TTT,$(BUILD_OVERRIDE_VARS),$(TTT)="$(BUILD_OVERRIDE_VAR_$(TTT))") $(foreach TTT,$(BUILD_OVERRIDE_DIRS),$(TTT)="$($(TTT))") -C $(OBJDIR) $(BUILD_ARGS)
@$(MAKECOOKIE)
build-%/Jamfile:
@echo " ==> Running bjam in $*"
@( cd $* ; $(BUILD_ENV) bjam $(JAMFLAGS) $(BUILD_ARGS) )
@$(MAKECOOKIE)
# Ruby makefiles
build-%/Rakefile:
@echo " ==> Running rake in $*"
@( cd $* ; $(BUILD_ENV) rake $(RAKEFLAGS) $(BUILD_ARGS) )
@$(MAKECOOKIE)
build-%/rakefile:
@echo " ==> Running rake in $*"
@( cd $* ; $(BUILD_ENV) rake $(RAKEFLAGS) $(BUILD_ARGS) )
@$(MAKECOOKIE)
build-%/setup.rb:
@echo " ==> Running setup.rb setup in $*"
@( cd $* ; $(BUILD_ENV) ruby ./setup.rb setup $(BUILD_ARGS) )
@$(MAKECOOKIE)
# WAF build, for details see http://code.google.com/p/waf/
build-%/waf:
@echo " ==> Running waf build in $*"
(cd $* ; $(BUILD_ENV) ./waf build $(BUILD_ARGS) )
@$(MAKECOOKIE)
# This can be: build, build_py, build_ext, build_clib, build_scripts
# See setup.py --help-commands for details
PYBUILD_CMD ?= build
build-%/setup.py:
@echo " ==> Running setup.py $(PYBUILD_TYPE) in $*"
@( cd $* ; $(BUILD_ENV) $(PYTHON_EXECUTABLE) ./setup.py $(PYBUILD_CMD) $(BUILD_ARGS) )
@$(MAKECOOKIE)
#################### CLEAN RULES ####################
CLEAN_ARGS ?= clean
# build from a standard gnu-style makefile's default rule.
clean-%/Makefile:
@echo " ==> Running clean in $*"
@cd $* && /usr/bin/env -i $(BUILD_ENV) $(MAKE) $(foreach TTT,$(BUILD_OVERRIDE_DIRS),$(TTT)="$($(TTT))") -C $(OBJDIR) $(CLEAN_ARGS)
@rm -f $(COOKIEDIR)/build-$*
clean-%/makefile:
@echo " ==> Running clean in $*"
@cd $* && $(BUILD_ENV) $(MAKE) $(foreach TTT,$(BUILD_OVERRIDE_DIRS),$(TTT)="$($(TTT))") -C $(OBJDIR) $(CLEAN_ARGS)
@rm -f $(COOKIEDIR)/build-$*
clean-%/GNUmakefile:
@echo " ==> Running clean in $*"
@cd $* && $(BUILD_ENV) $(MAKE) $(foreach TTT,$(BUILD_OVERRIDE_DIRS),$(TTT)="$($(TTT))") -C $(OBJDIR) $(CLEAN_ARGS)
@rm -f $(COOKIEDIR)/build-$*
clean-%/Jamfile:
$(error *** Don't know how to clean Jamfiles)
clean-%/Rakefile:
$(error *** Don't know how to clean Rakefiles)
clean-%/rakefile:
$(error *** Don't know how to clean Rakefiles)
clean-%/setup.rb:
$(error *** Don't know how to clean Ruby setups)
clean-%/setup.py:
$(error *** Don't know how to clean Python builds)
#################### TEST RULES ####################
TEST_TARGET ?= check
# Run tests on pre-built sources
test-%/Makefile:
@echo " ==> Running make $(TEST_TARGET) in $*"
cd $* && /usr/bin/env -i $(TEST_ENV) $(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)
@$(MAKECOOKIE)
test-%/makefile:
@echo " ==> Running make $(TEST_TARGET) in $*"
@cd $* && $(TEST_ENV) $(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)
@$(MAKECOOKIE)
test-%/GNUmakefile:
@echo " ==> Running make $(TEST_TARGET) in $*"
@cd $* && $(TEST_ENV) $(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)
@$(MAKECOOKIE)
# Ruby makefiles
test-%/Rakefile:
@echo " ==> Running rake $(TEST_TARGET) in $*"
@( cd $* ; cd $(OBJDIR) ; $(TEST_ENV) rake $(RAKEFLAGS) $(TEST_ARGS) $(TEST_TARGET) )
@$(MAKECOOKIE)
test-%/rakefile:
@echo " ==> Running rake $(TEST_TARGET) in $*"
@( cd $* ; cd $(OBJDIR) ; $(TEST_ENV) rake $(RAKEFLAGS) $(TEST_ARGS) $(TEST_TARGET) )
@$(MAKECOOKIE)
# WAF build, for details see http://code.google.com/p/waf/
test-%/waf:
@echo " ==> Running waf $(TEST_TARGET) in $*"
(cd $* ; $(BUILD_ENV) ./waf $(TEST_TARGET) )
@$(MAKECOOKIE)
test-%/setup.py:
@echo " ==> Running setup.py test in $*"
@( cd $* ; cd $(OBJDIR) ; $(TEST_ENV) $(PYTHON_EXECUTABLE) ./setup.py $(PYTHON_TEST_TARGET) $(TEST_ARGS) )
@$(MAKECOOKIE)
################# INSTALL RULES ####################