bc46d8a410d8655147dab0f54ecf2fbffb11eb5d
[drupal.git] / Makefile
1 #
2 WEBFETCH := curl -H Pragma: -O -R -S --fail --show-error
3 SHA1SUM  := sha1sum
4
5 version=4.7.11
6
7 ALL             += drupal
8 # for fedora29
9 # this patch is about commenting off one line in settings.php:
10 #this causes a php error in fedora29/php7.2
11 #ini_set('session.save_handler',     'user'); 
12 drupal-URL1     := http://mirror.onelab.eu/third-party/drupal-$(version)-patch-php72.tar.gz
13 drupal-URL2     := $(drupal-URL1)
14 drupal-SHA1SUM  := f99343938b418384859ff2ced0a0870824e73a13
15 # so we can no longer use upstream that was here:
16 #drupal-URL2    := http://ftp.drupal.org/files/projects/drupal-$(version).tar.gz
17 drupal          := $(notdir $(drupal-URL1))
18
19 ALL             += taxo
20 taxo-URL1       := http://mirror.onelab.eu/third-party/taxonomy_block-4.7.x-1.x-dev.tar.gz
21 taxo-URL2       := http://build.planet-lab.org/third-party/taxonomy_block-4.7.x-1.x-dev.tar.gz
22 taxo-SHA1SUM    := 9d926df1695c0092a74446154b00579d4ccbcb60
23 taxo            := $(notdir $(taxo-URL1))
24
25 all: $(ALL)
26 .PHONY: all
27
28 ##############################
29 define download_target
30 $(1): $($(1))
31 .PHONY: $(1)
32 $($(1)): 
33         @if [ ! -e "$($(1))" ] ; then \
34         { echo Using primary; echo "$(WEBFETCH) $($(1)-URL1)" ; $(WEBFETCH) $($(1)-URL1) ; } || \
35         { echo Using secondary; echo "$(WEBFETCH) $($(1)-URL2)" ; $(WEBFETCH) $($(1)-URL2) ; } ; fi
36         @if [ ! -e "$($(1))" ] ; then echo "Could not download source file: $($(1)) does not exist" ; exit 1 ; fi
37         @if test "$$$$($(SHA1SUM) $($(1)) | awk '{print $$$$1}')" != "$($(1)-SHA1SUM)" ; then \
38             echo "sha1sum of the downloaded $($(1)) does not match the one from 'Makefile'" ; \
39             echo "Local copy: $$$$($(SHA1SUM) $($(1)))" ; \
40             echo "In Makefile: $($(1)-SHA1SUM)" ; \
41             false ; \
42         else \
43             ls -l $($(1)) ; \
44         fi
45 endef
46
47 $(eval $(call download_target,drupal))
48 $(eval $(call download_target,taxo))
49
50 sources: $(ALL) 
51 .PHONY: sources
52
53 ####################
54 # default - overridden by the build
55 SPECFILE = drupal.spec
56
57 PWD=$(shell pwd)
58 PREPARCH ?= noarch
59 RPMDIRDEFS = --define "_sourcedir $(PWD)" --define "_builddir $(PWD)" --define "_srcrpmdir $(PWD)" --define "_rpmdir $(PWD)"
60 trees: sources
61         rpmbuild $(RPMDIRDEFS) $(RPMDEFS) --nodeps -bp --target $(PREPARCH) $(SPECFILE)
62
63 srpm: sources
64         rpmbuild $(RPMDIRDEFS) $(RPMDEFS) --nodeps -bs $(SPECFILE)
65
66 TARGET ?= $(shell uname -m)
67 rpm: sources
68         rpmbuild $(RPMDIRDEFS) $(RPMDEFS) --nodeps --target $(TARGET) -bb $(SPECFILE)
69
70 clean:
71         rm -f *.rpm *.tgz *.bz2 *.gz
72
73 ++%: varname=$(subst +,,$@)
74 ++%:
75         @echo "$(varname)=$($(varname))"
76 +%: varname=$(subst +,,$@)
77 +%:
78         @echo "$($(varname))"