blob: 664aea6194791e88604a9ca8b5def1f0f3ef9552 (
plain)
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
|
# $Id$
.PHONY : test log all install clean distclean uninstall encaps rename bcfg2only bcfg2bump
.SUFFIXES :
.SUFFIXES : .ep .sh .installed .packaged .d
export BASEDIR = /usr/local
export ENCAPDIR := ${BASEDIR}/encap
export EPKG := ${BASEDIR}/bin/epkg
export MKENCAP := ${BASEDIR}/bin/mkencap
export SHELL = /bin/sh
srcdir = .
export EP2TARGET := $(srcdir)/ep2target
BCFG2 := $(basename $(wildcard bcfg2-[0-9].[0-9]*.ep))
BCFG2_CHEETAH := $(basename $(wildcard bcfg2-cheetah-[0-9].[0-9]*.ep))
BCFG2_CHEETAH_DOC := $(basename $(wildcard bcfg2-cheetah-doc-*.ep))
BCFG2_GAMIN := $(basename $(wildcard bcfg2-gamin-*.ep))
BCFG2_GETTEXT := $(basename $(wildcard bcfg2-gettext-*.ep))
BCFG2_GLIB := $(basename $(wildcard bcfg2-glib-*.ep))
BCFG2_LIBGCC := $(basename $(wildcard bcfg2-libgcc-*.sh))
BCFG2_LIBICONV := $(basename $(wildcard bcfg2-libiconv-*.ep))
BCFG2_LIBSTDCXX := $(basename $(wildcard bcfg2-libstdc++-*.sh))
BCFG2_LIBXML2 := $(basename $(wildcard bcfg2-libxml2-*.ep))
BCFG2_LIBXSLT := $(basename $(wildcard bcfg2-libxslt-*.ep))
BCFG2_LXML := $(basename $(wildcard bcfg2-lxml-*.ep))
BCFG2_OPENSSL := $(basename $(wildcard bcfg2-openssl-*.ep))
BCFG2_PKG_CONFIG := $(basename $(wildcard bcfg2-pkg-config-*.ep))
BCFG2_PYOPENSSL := $(basename $(wildcard bcfg2-pyopenssl-*.ep))
BCFG2_PYREX := $(basename $(wildcard bcfg2-pyrex-*.ep))
BCFG2_PYTHON := $(basename $(wildcard bcfg2-python-[0-9].[0-9]*.ep))
BCFG2_ZLIB := $(basename $(wildcard bcfg2-zlib-*.ep))
DAEMONTOOLS := $(basename $(wildcard daemontools-[0-9].[0-9]*.ep))
DAEMONTOOLS_DOC := $(basename $(wildcard daemontools-doc-*.ep))
M4 := $(basename $(wildcard m4-*.sh))
MAKESELF := $(basename $(wildcard makeself-*.ep))
OSTIARTY := $(basename $(wildcard ostiary-[0-9].[0-9]*.ep))
OSTIARTY_DOC := $(basename $(wildcard ostiary-doc-*.ep))
PATCH := $(basename $(wildcard patch-*.ep))
sources_ep := $(sort $(BCFG2) $(BCFG2_CHEETAH) $(BCFG2_CHEETAH_DOC) $(BCFG2_GETTEXT) $(BCFG2_LIBICONV) $(BCFG2_LIBXML2) $(BCFG2_LIBXSLT) $(BCFG2_LXML) $(BCFG2_OPENSSL) $(BCFG2_PKG_CONFIG) $(BCFG2_PYOPENSSL) $(BCFG2_PYREX) $(BCFG2_PYTHON) $(BCFG2_ZLIB) $(DAEMONTOOLS) $(DAEMONTOOLS_DOC) $(MAKESELF) $(OSTIARTY) $(OSTIARTY_DOC) $(PATCH))
sources_sh := $(sort $(BCFG2_LIBGCC) $(BCFG2_LIBSTDCXX) $(M4))
# Only compile bcfg2-glib and bcfg2-gamin (needed by bcfg2 server) on Linux
# (Gamin only supports Linux), and only compile bcfg2-python-apt on known
# Debian and Ubuntu systems (as python-apt is distribution-specific)
UNAME := $(shell uname)
ifeq ($(UNAME),Linux)
sources_ep += $(BCFG2_GLIB) $(BCFG2_GAMIN)
DISTRO := $(shell cat /etc/issue | head -1)
endif
ifeq ($(DISTRO),Debian GNU/Linux 3.1 \n \l)
BCFG2_PYTHON_APT = bcfg2-python-apt-0.5.10
OS ?= linux_debian_sarge
endif
ifeq ($(DISTRO),Debian GNU/Linux testing/unstable \n \l)
BCFG2_PYTHON_APT = bcfg2-python-apt-0.6.19
OS ?= linux_debian_sid
endif
ifeq ($(DISTRO),Ubuntu 6.06.1 LTS \n \l)
BCFG2_PYTHON_APT = bcfg2-python-apt-0.6.16.2ubuntu8
OS ?= linux_ubuntu_dapper
endif
ifdef BCFG2_PYTHON_APT
sources_ep += $(BCFG2_PYTHON_APT)
endif
# List of all sources...
sources := $(sort $(sources_ep) $(sources_sh))
%.installed : %.ep # Clean, compile and install an encap package
@printf "***** START .ep.installed for |$*| ***** \n"
-$(EPKG) -q -r $(ENCAPDIR)/$*
-rm -rf $(ENCAPDIR)/$*
-$(MKENCAP) -m /usr/local/bin/m4 -b -DUP $(srcdir)/$*.ep > ./$*.log 2>&1
-$(MKENCAP) -m /usr/local/bin/m4 -b -T $(srcdir)/$*.ep >> ./$*.log 2>&1
$(MKENCAP) -m /usr/local/bin/m4 -b -CBI $(srcdir)/$*.ep >> ./$*.log 2>&1
$(EPKG) -q -i $(ENCAPDIR)/$*
test -h $(BASEDIR)/var/encap/$*
touch ./$*.installed
@printf "***** STOP .ep.installed for |$*| ***** \n"
%.installed : %.sh # Create and install a "fake" encap package
@printf "***** START .sh.installed for |$*| ***** \n"
-$(EPKG) -q -r $(ENCAPDIR)/$*
-rm -rf $(ENCAPDIR)/$*
chmod 755 $(srcdir)/$*.sh && $(srcdir)/$*.sh
$(EPKG) -q -i $(ENCAPDIR)/$*
test -h $(BASEDIR)/var/encap/$*
touch ./$*.installed
@printf "***** STOP .sh.installed for |$*| ***** \n"
%.packaged : %.installed # Create .tar.gz encap packages
@printf "***** START .installed.packaged for |$*| ***** \n"
-rm $(ENCAPDIR)/$*-*.tar.gz
-(cd $(ENCAPDIR) && $(MKENCAP) -e $*)
-(cd $(ENCAPDIR) && $(MKENCAP) -c $*)
mv $(ENCAPDIR)/$*-encap-*.tar.gz ./
touch ./$*.packaged
@printf "***** STOP .installed.packaged for |$*| ***** \n"
%.d : %.ep # Create dependancy files from .ep files
@printf "***** START .d.ep for |$*| ***** \n"
chmod 755 $(EP2TARGET) && $(EP2TARGET) $< > $@
@printf "***** STOP .d.ep for |$*| ***** \n"
%.d : %.sh # Create dependancy files from .sh files
@printf "***** START .d.sh for |$*| ***** \n"
chmod 755 $(EP2TARGET) && $(EP2TARGET) $< > $@
@printf "***** STOP .d.sh for |$*| ***** \n"
log :
( $(MAKE) install > ./make.log 2>&1 \
&& $(MAKE) encaps >> ./make.log 2>&1 \
&& $(MAKE) rename >> ./make.log 2>&1 ) &
all : install encaps rename
.DELETE_ON_ERROR : # delete the target of a rule if it has changed and its
# commands exit with a nonzero exit status
install : $(EPKG) $(MKENCAP) $(EP2TARGET) $(M4).installed $(addsuffix .installed,$(sources))
encaps : $(EPKG) $(MKENCAP) $(EP2TARGET) $(addsuffix .packaged,$(sources))
rename : encaps
if [ "$(OS)x" != "x" ]; then OS="$(OS)"; fi && \
if [ "$${OS}x" != "x" ]; then \
for OLDNAME in `ls ./*-encap-*.tar.gz`; do \
NEWNAME="`printf "%s\n" "$${OLDNAME}" \
| awk -F- '{$$NF = "OSDIST.tar.gz" ; print}' \
| sed s:\ :-:g | sed s:OSDIST:\$${OS}:g`" ; \
if [ "$${OLDNAME}x" != "$${NEWNAME}x" ]; then \
mv ./$${OLDNAME} ./$${NEWNAME}; \
fi; \
done; \
fi
for OLDNAME in `ls ./*-doc-*-encap-*.tar.gz`; do \
NEWNAME="`printf "%s\n" "$${OLDNAME}" \
| awk -F- '{$$NF = "OSDIST.tar.gz" ; print}' \
| sed s:\ :-:g | sed s:OSDIST:share:g`" ; \
if [ "$${OLDNAME}x" != "$${NEWNAME}x" ]; then \
mv ./$${OLDNAME} ./$${NEWNAME}; \
fi; \
done;
clean :
-(rm ./*.log; rm ./*.packaged; rm ./*.gz; rm ./*~)
distclean : clean
-rm ./*.d
uninstall : distclean
-(find $(BASEDIR)/lib/bcfg2 | grep "\.pyc" | xargs -n1 rm)
-(ENCAPS="m4 patch daemontools makeself ostiary bcfg2"; \
for ENCAP in $${ENCAPS}; do \
$(EPKG) -q -r $(ENCAPDIR)/$${ENCAP}-*; \
rm -rf $(ENCAPDIR)/$${ENCAP}-*; \
rm ./$${ENCAP}-*.installed; \
done)
-rm -rf $(BASEDIR)/lib/bcfg2
bcfg2only :
$(MAKE) -t; sleep 2; touch $(srcdir)/$(BCFG2).ep; $(MAKE)
bcfg2bump :
@if [ "$(NEWVERSION)x" != "x" ]; then NEWVERSION="$(NEWVERSION)"; fi && \
if [ "$(FORCE)x" != "x" ]; then FORCE="$(FORCE)"; fi && \
if [ "$${NEWVERSION}x" != "x" ]; then \
if [ "$${FORCE}x" != "yesmamx" ]; then \
printf "About to 'svn mv %s %s'\n" "$(BCFG2).ep" "$$NEWVERSION"; \
printf "\tand edit the later as appropriate.\n"; \
printf "Press 'return' to continue, or 'ctrl-c' to exit. "; \
read THROWAWAY; \
fi; \
svn mv $(BCFG2).ep $${NEWVERSION}; \
NVBASE="`printf "%s\n" "$${NEWVERSION}" | sed 's:\.ep::g'`"; \
sed s:$(BCFG2):$$NVBASE:g $${NEWVERSION} > $${NEWVERSION}.tmp; \
mv $${NEWVERSION}.tmp $${NEWVERSION}; \
printf "Changes to %s are:\n" "$${NEWVERSION}"; \
svn diff $${NEWVERSION}; \
if [ "$${FORCE}x" != "yesmamx" ]; then \
printf "'svn commit %s -m \"EncapPackages: Bumped bcfg2 .ep version to %s\"'? \n" "$${NEWVERSION}" "$${NEWVERSION}"; \
printf "Press 'return' to commit, or 'ctrl-c' to exit. "; \
read THROWAWAY; \
fi; \
svn commit $${NEWVERSION} -m "EncapPackages: Bumped bcfg2 .ep version to $${NVBASE}"; \
else \
printf "Set the NEWVERSION (and optionally FORCE) environment variables\n"; \
printf "Example: 'NEWVERSION=bcfg2-0.8.3.ep $(MAKE) bcfg2bump'\n"; \
fi
include $(addsuffix .d,$(sources))
|