source: branches/1.0/Makefile @ 914

Last change on this file since 914 was 914, checked in by olahaye, 8 years ago

[Makefile] Fix debian build with new VERSION handeling.

File size: 6.5 KB
Line 
1# Where to build
2#
3TMPDIR = /tmp
4
5# Where to install
6DESTDIR = 
7
8# Install prefix
9PREFIX = /usr/local
10
11BIN_DIR = $(PREFIX)/sbin
12JOBMOND = $(BIN_DIR)/jobmond
13JOBARCHIVED = $(BIN_DIR)/jobarchived
14
15# What is the location of the Ganglia web frontend
16# i.e.: where to we install Job Monarch's web frontend addon
17#
18GANGLIA_ROOT = $(PREFIX)/ganglia
19GANGLIA_USER = ganglia.ganglia
20HTTPD_USER   = apache.apache
21
22# Where jobarchived RRDS are stored
23JOBARCHIVE_RRDS = $(PREFIX)/jobmonarch
24
25# Clear this if you don't want to use ${FAKEROOT}
26#
27FAKEROOT = fakeroot
28
29VERSION = 1.1
30RELEASE = 1
31
32REQUIRED = ./jobarchived ./jobmond ./web
33
34all:    tarball rpm srpm deb
35
36tarball:        tarball-gzip tarball-bzip
37
38$(TMPDIR)/.monarch_buildroot: ${REQUIRED} Makefile
39        @mkdir -p ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}
40        @( rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php \
41        . ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION} )
42        @sed -i -e 's|__VERSION__|$(VERSION)|g' -e 's/__RELEASE__/$(RELEASE)/g' \
43                ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}/jobmond/jobmond.py \
44                ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}/jobarchived/jobarchived.py \
45                ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}/web/addons/job_monarch/version.php \
46                ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}/pkg/rpm/jobmonarch.spec \
47                ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}/debian/changelog
48
49
50tarball-gzip:   $(TMPDIR)/.monarch_buildroot ${REQUIRED}
51        @( cd ${TMPDIR}/.monarch_buildroot; tar zcf ganglia_jobmonarch-${VERSION}.tar.gz ./ganglia_jobmonarch-${VERSION} )
52        @mv ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}.tar.gz ..
53        @rm -rf ${TMPDIR}/.monarch_buildroot
54        @echo "Wrote: ../ganglia_jobmonarch-${VERSION}.tar.gz"
55
56tarball-bzip:   $(TMPDIR)/.monarch_buildroot ${REQUIRED}
57        @( cd ${TMPDIR}/.monarch_buildroot; tar jcf ganglia_jobmonarch-${VERSION}.tar.bz2 ./ganglia_jobmonarch-${VERSION} )
58        @mv ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}.tar.bz2 ..
59        @rm -rf ${TMPDIR}/.monarch_buildroot
60        @echo "Wrote: ../ganglia_jobmonarch-${VERSION}.tar.bz2"
61
62rpm: tarball-bzip
63        # Binary package will reflect most distro where ganglia default location is /usr/share/ganglia
64        rpmbuild -tb --define '%custom_web_prefixdir /usr/share/ganglia' ../ganglia_jobmonarch-${VERSION}.tar.bz2
65
66srpm: tarball-bzip
67        rpmbuild -ts --define '%dist %{nil}' ../ganglia_jobmonarch-${VERSION}.tar.bz2
68
69debchangelog: ./debian/changelog
70
71deb: ${REQUIRED} $(TMPDIR)/.monarch_buildroot ./debian
72        @( cd ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}; dpkg-buildpackage -b -uc -us )
73        @mv ${TMPDIR}/ganglia_jobmonarch-${VERSION}/jobmonarch*$(VERSION)*.deb ..
74        @rm -rf ${TMPDIR}/.monarch_buildroot
75        @echo "Wrote:"
76        @ls -1 ../jobmonarch*$(VERSION)*.deb
77
78install:  ${REQUIRED}
79        @#
80        @# Set the correct GANGLIA_PATH.
81        @#
82        @echo
83        @echo "Using $(GANGLIA_ROOT) as Ganglia root installation path. If it's not what"
84        @echo "you want, use make GANGLIA_ROOT=/path/to/your/ganglia/root ."
85        @sed -e 's|__GANGLIA_ROOT__|$(GANGLIA_ROOT)/|g' web/conf.php.in > web/addons/job_monarch/conf.php
86        @#
87        @# Set the correct JOBARCHIVE_RRDS in jobarchve.conf and ganglia conf.php
88        @#
89        @echo
90        @echo "Using $(JOBARCHIVE_RRDS) as jobarchive path to  store rrds files. If it's not what"
91        @echo "you want, use make JOBARCHIVE_RRDS=/path/to/you/jobarchived/rrdsfiles ."
92        @sed -i -e 's|/var/lib/jobarchive|$(JOBARCHIVE_RRDS)|g' jobarchived/jobarchived.conf web/addons/job_monarch/conf.php
93        @#
94        @# Files in SBIN_DIR
95        @#
96        @echo
97        @echo "Installing jobmond.py and jobarchived.py to $(PREFIX)/sbin"
98        @install -m 0755 -d $(DESTDIR)$(PREFIX)/sbin || true
99        @install -m 0755 jobmond/jobmond.py $(DESTDIR)$(PREFIX)/sbin/ || true
100        @install -m 0755 jobarchived/jobarchived.py $(DESTDIR)$(PREFIX)/sbin/ || true
101        @(cd $(DESTDIR)$(PREFIX)/sbin/; ln -s jobmond.py jobmond; ln -s jobarchived.py jobarchived) || true
102        @#
103        @# Files specific to distros if /etc/redhat-release => rpm else (/etc/debian_version => debian)
104        @#
105        @echo
106        @echo "Installing service files in /etc"
107        @sed -i -e 's|DAEMON=.*|DAEMON=$(JOBMOND)|g' pkg/deb/init.d/jobmond
108        @sed -i -e 's|DAEMON=.*|DAEMON=$(JOBARCHIVED)|g' pkg/deb/init.d/jobarchived
109        @sed -i -e 's|DAEMON=.*|DAEMON=$(JOBMOND)|g' pkg/rpm/init.d/jobmond
110        @sed -i -e 's|DAEMON=.*|DAEMON=$(JOBARCHIVED)|g' pkg/rpm/init.d/jobarchived
111        @if test -r /etc/redhat-release; then \
112                install -m 0755 -d $(DESTDIR)/etc/rc.d/init.d; \
113                install -m 0755 pkg/rpm/init.d/jobmond $(DESTDIR)/etc/rc.d/init.d/; \
114                install -m 0755 pkg/rpm/init.d/jobarchived $(DESTDIR)/etc/rc.d/init.d/; \
115                install -m 0755 -d $(DESTDIR)/etc/sysconfig; \
116                install -m 0755 pkg/rpm/sysconfig/jobmond $(DESTDIR)/etc/sysconfig; \
117                install -m 0755 pkg/rpm/sysconfig/jobarchived $(DESTDIR)/etc/sysconfig; \
118        else \
119                install -m 0755 -d $(DESTDIR)/etc/init.d; \
120                install -m 0755 pkg/deb/init.d/jobmond $(DESTDIR)/etc/init.d/; \
121                install -m 0755 pkg/deb/init.d/jobarchived $(DESTDIR)/etc/init.d/; \
122                install -m 0755 -d $(DESTDIR)/etc/default; \
123                install -m 0755 pkg/deb/default/jobmond $(DESTDIR)/etc/default; \
124                install -m 0755 pkg/deb/default/jobarchived $(DESTDIR)/etc/default; \
125        fi
126        @#
127        @# Files in /etc
128        @#
129        @echo
130        @echo "Installing config files jobmond.conf jobarchived.conf in /etc"
131        @install -m 0644 jobmond/jobmond.conf $(DESTDIR)/etc
132        @install -m 0644 jobarchived/jobarchived.conf $(DESTDIR)/etc
133        @#
134        @# Files in /usr/share
135        @#
136        @echo
137        @echo "Installing job_dbase.sql in $(PREFIX)/share/jobarchived"
138        @install -m 0755 -d $(DESTDIR)$(PREFIX)/share/jobarchived
139        @install -m 0755 jobarchived/job_dbase.sql $(DESTDIR)$(PREFIX)/share/jobarchived/
140        @#
141        @# Create the /var/lib/jobarchive directory where rrds are stored.
142        @#
143        @echo
144        @echo "Creating the directory where RRDs will be stored: $(JOBARCHIVE_RRDS)"
145        @install -m 0755 -d $(DESTDIR)$(JOBARCHIVE_RRDS)
146        @#
147        @# Files for ganglia
148        @#
149        @echo
150        @echo "Installing Ganglia web interface to $(GANGLIA_ROOT) ."
151        @install -m 0755 -d $(DESTDIR)$(GANGLIA_ROOT)
152        @chown -R $(GANGLIA_USER) ./web
153        @chown $(HTTPD_USER) ./web/addons/job_monarch/dwoo/compiled
154        @chown $(HTTPD_USER) ./web/addons/job_monarch/dwoo/cache
155        @chmod 775 ./web/addons/job_monarch/dwoo/cache
156        @(cd web; rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php ./addons ./templates $(DESTDIR)$(GANGLIA_ROOT)/)
157        @#
158        @echo
159        @echo "Installation complete."
160        @echo
161
162clean:
163        @rm -rf ${TMPDIR}/.monarch_buildroot
164        @(cd ./debian; rm -rf files *.log *.substvars jobmonarch/ jobmonarch-jobmond/ jobmonarch-jobarchived/ jobmonarch-webfrontend/ tmp/)
165        @rm -f web/addons/job_monarch/conf.php
Note: See TracBrowser for help on using the repository browser.