source: branches/1.0/Makefile @ 844

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

[Makefile] Added srpm: rule and fixed web interface ownership

File size: 9.9 KB
Line 
1# Where to build
2#
3TMPDIR = /tmp
4
5# Where to install
6DESTDIR = 
7
8# Install prefix
9PREFIX = /usr/local
10
11# What is the location of the Ganglia web frontend
12# i.e.: where to we install Job Monarch's web frontend addon
13#
14GANGLIA_ROOT = $(PREFIX)/ganglia
15GANGLIA_USER = ganglia.ganglia
16HTTPD_USER   = apache.apache
17
18# Where jobarchived RRDS are stored
19JOBARCHIVE_RRDS = $(PREFIX)/jobmonarch
20
21# Clear this if you don't want to use ${FAKEROOT}
22#
23FAKEROOT = fakeroot
24
25VERSION = 1.0
26RELEASE = 1
27
28REQUIRED = ./jobarchived ./jobmond ./web
29
30deb:    tarball-bzip
31rpm:    tarball-bzip
32
33all:    tarball deb rpm
34
35tarball:        tarball-gzip tarball-bzip
36
37tarball-gzip:   ${REQUIRED} ./pkg/rpm/jobmonarch.spec
38        mkdir -p ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}
39        ( rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php \
40        . ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION} )
41        ( cd ${TMPDIR}/.monarch_buildroot; tar zcvf ganglia_jobmonarch-${VERSION}.tar.gz ./ganglia_jobmonarch-${VERSION} )
42        mv ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}.tar.gz ..
43
44tarball-bzip:   ${REQUIRED} ./pkg/rpm/jobmonarch.spec
45        mkdir -p ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}
46        ( rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php \
47        . ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION} )
48        ( cd ${TMPDIR}/.monarch_buildroot; tar jcvf ganglia_jobmonarch-${VERSION}.tar.bz2 ./ganglia_jobmonarch-${VERSION} )
49        mv ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}.tar.bz2 ..
50
51rpmspec: ./pkg/rpm/jobmonarch.spec
52
53./pkg/rpm/jobmonarch.spec: pkg/rpm/jobmonarch.spec.in
54        sed -e 's/__VERSION__/$(VERSION)/g' -e 's/__RELEASE__/$(RELEASE)/g' ./pkg/rpm/jobmonarch.spec.in > ./pkg/rpm/jobmonarch.spec
55
56debian: pkg/deb/debian
57        rsync -a --exclude=.svn pkg/deb/debian ./
58        sed -i -e 's/^Version:.*$//Version: $(VERSION)-$(RELEASE)/g' ./debian/control
59
60rpm: tarball-bzip
61        rpmbuild -tb ../ganglia_jobmonarch-${VERSION}.tar.bz2
62
63srpm: tarball-bzip
64        rpmbuild -ts --define '%dist %{nil}' ../ganglia_jobmonarch-${VERSION}.tar.bz2
65
66deb: debian
67        dpkg-buildpackage -b
68
69install:
70        @#
71        @# Set the correct GANGLIA_PATH.
72        @#
73        @echo "\nUsing $(GANGLIA_ROOT) as Ganglia root installation path. If it's not what"
74        @echo "you want, use make GANGLIA_ROOT=/path/to/your/ganglia/root ."
75        @sed -i -e 's|/var/www/ganglia/|$(GANGLIA_ROOT)/|g' web/addons/job_monarch/conf.php
76        @#
77        @# Set the correct JOBARCHIVE_RRDS in jobarchve.conf and ganglia conf.php
78        @#
79        @echo "\nUsing $(JOBARCHIVE_RRDS) as jobarchive path to  store rrds files. If it's not what"
80        @echo "you want, use make JOBARCHIVE_RRDS=/path/to/you/jobarchived/rrdsfiles ."
81        @sed -i -e 's|/var/lib/jobarchive|$(JOBARCHIVE_RRDS)|g' jobarchived/jobarchived.conf web/addons/job_monarch/conf.php
82        @#
83        @# Files in SBIN_DIR
84        @#
85        @echo "\nInstalling jobmond.py and jobarchived.py to $(PREFIX)/sbin"
86        @install -m 0755 -d $(DESTDIR)$(PREFIX)/sbin
87        @install -m 0755 jobmond/jobmond.py $(DESTDIR)$(PREFIX)/sbin/
88        @install -m 0755 jobarchived/jobarchived.py $(DESTDIR)$(PREFIX)/sbin/
89        @(cd $(DESTDIR)$(PREFIX)/sbin/; ln -s jobmond.py jobmond; ln -s jobarchived.py jobarchived)
90        @#
91        @# Files specific to distros if /etc/sysconfig => rpm else (/etc/default => debian)
92        @#
93        @echo "\nInstalling service files in $(DESTDIR)/etc"
94        @if test -d /etc/sysconfig; then \
95                install -m 0755 -d $(DESTDIR)/etc/rc.d/init.d; \
96                install -m 0755 pkg/rpm/init.d/jobmond $(DESTDIR)/etc/rc.d/init.d/; \
97                install -m 0755 pkg/rpm/init.d/jobarchived $(DESTDIR)/etc/rc.d/init.d/; \
98                install -m 0755 -d $(DESTDIR)/etc/sysconfig; \
99                install -m 0755 pkg/rpm/sysconfig/jobmond $(DESTDIR)/etc/sysconfig; \
100                install -m 0755 pkg/rpm/sysconfig/jobarchived $(DESTDIR)/etc/sysconfig; \
101        else \
102                install -m 0755 -d $(DESTDIR)/etc/init.d; \
103                install -m 0755 pkg/deb/init.d/jobmond $(DESTDIR)/etc/init.d/; \
104                install -m 0755 pkg/deb/init.d/jobarchived $(DESTDIR)/etc/init.d/; \
105                install -m 0755 -d $(DESTDIR)/etc/default; \
106                install -m 0755 pkg/deb/default/jobmond $(DESTDIR)/etc/default; \
107                install -m 0755 pkg/deb/default/jobarchived $(DESTDIR)/etc/default; \
108        fi
109        @#
110        @# Files in /etc
111        @#
112        @echo "\nInstalling config files jobmond.conf jobarchived.conf in $(DESTDIR)/etc"
113        @install -m 0644 jobmond/jobmond.conf $(DESTDIR)/etc
114        @install -m 0644 jobarchived/jobarchived.conf $(DESTDIR)/etc
115        @#
116        @# Files in /usr/share
117        @#
118        @echo "\nInstalling job_dbase.sql in $(PREFIX)/share/jobarchived"
119        @install -m 0755 -d $(DESTDIR)$(PREFIX)/share/jobarchived
120        @install -m 0755 jobarchived/job_dbase.sql $(DESTDIR)$(PREFIX)/share/jobarchived/
121        @#
122        @# Create the /var/lib/jobarchive directory where rrds are stored.
123        @#
124        @echo "\nCreating the directory where RRDs will be stored: $(JOBARCHIVE_RRDS)"
125        @install -m 0755 -d $(DESTDIR)$(JOBARCHIVE_RRDS)
126        @#
127        @# Files for ganglia
128        @#
129        @echo "\nInstalling Ganglia web interface to $(GANGLIA_ROOT) ."
130        @install -m 0755 -d $(DESTDIR)$(GANGLIA_ROOT)
131        @chown -R $(GANGLIA_USER) ./web
132        @chown $(HTTPD_USER) ./web/addons/job_monarch/dwoo/compiled
133        @(cd web; rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php . $(DESTDIR)$(GANGLIA_ROOT)/)
134        @#
135        @echo "\nInstallation complete.\n"
136
137deb-webfrontend:        ${REQUIRED}
138        mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-webfrontend_${VERSION}-${RELEASE}/DEBIAN >/dev/null
139        mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-webfrontend_${VERSION}-${RELEASE}/${GANGLIA_ROOT} >/dev/null
140        ( cd web; rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php \
141        . ${TMPDIR}/.monarch_buildroot/jobmonarch-webfrontend_${VERSION}-${RELEASE}/${GANGLIA_ROOT} )
142        ( cd pkg/deb/web/DEBIAN; \
143        rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php \
144        . ${TMPDIR}/.monarch_buildroot/jobmonarch-webfrontend_${VERSION}-${RELEASE}/DEBIAN )
145        ( cd ${TMPDIR}/.monarch_buildroot/; cat jobmonarch-webfrontend_${VERSION}-${RELEASE}/DEBIAN/control \
146        | sed "s/^Version:.*$//Version: ${VERSION}-${RELEASE}/g" >jobmonarch-webfrontend_${VERSION}-${RELEASE}/DEBIAN/control.new; \
147        mv jobmonarch-webfrontend_${VERSION}-${RELEASE}/DEBIAN/control.new \
148        jobmonarch-webfrontend_${VERSION}-${RELEASE}/DEBIAN/control )
149        ( cd ${TMPDIR}/.monarch_buildroot/; ${FAKEROOT} dpkg -b jobmonarch-webfrontend_${VERSION}-${RELEASE} )
150        mv ${TMPDIR}/.monarch_buildroot/jobmonarch-webfrontend_${VERSION}-${RELEASE}.deb ..
151
152deb-jobarchived:        ${REQUIRED}
153        mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}/DEBIAN >/dev/null
154        mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}/etc/init.d >/dev/null
155        mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}/etc/default >/dev/null
156        mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}/usr/sbin >/dev/null
157        mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}/usr/share/jobarchived >/dev/null
158        install -m 755 jobarchived/jobarchived.py ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}/usr/sbin
159        ( cd ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}/usr/sbin; \
160        ln -s jobarchived.py jobarchived || true)
161        install jobarchived/jobarchived.conf ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}/etc
162        install pkg/deb/init.d/jobarchived ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}/etc/init.d
163        install pkg/deb/default/jobarchived ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}/etc/default
164        install jobarchived/job_dbase.sql \
165        ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}/usr/share/jobarchived
166        ( cd pkg/deb/jobarchived/DEBIAN; \
167        rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php \
168        . ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}/DEBIAN )
169        ( cd ${TMPDIR}/.monarch_buildroot/; cat jobmonarch-jobarchived_${VERSION}-${RELEASE}/DEBIAN/control \
170        | sed "s/^Version:.*$//Version: ${VERSION}-${RELEASE}/g" >jobmonarch-jobarchived_${VERSION}-${RELEASE}/DEBIAN/control.new; \
171        mv jobmonarch-jobarchived_${VERSION}-${RELEASE}/DEBIAN/control.new \
172        jobmonarch-jobarchived_${VERSION}-${RELEASE}/DEBIAN/control )
173        ( cd ${TMPDIR}/.monarch_buildroot/; ${FAKEROOT} dpkg -b jobmonarch-jobarchived_${VERSION}-${RELEASE} )
174        mv ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}.deb ..
175
176deb-jobmond:    ${REQUIRED}
177        mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond_${VERSION}-${RELEASE}/DEBIAN >/dev/null
178        mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond_${VERSION}-${RELEASE}/etc/init.d >/dev/null
179        mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond_${VERSION}-${RELEASE}/etc/default >/dev/null
180        mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond_${VERSION}-${RELEASE}/usr/sbin >/dev/null
181        install -m 755 jobmond/jobmond.py ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond_${VERSION}-${RELEASE}/usr/sbin
182        ( cd ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond_${VERSION}-${RELEASE}/usr/sbin; \
183        ln -s jobmond.py jobmond || true)
184        install jobmond/jobmond.conf ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond_${VERSION}-${RELEASE}/etc
185        install pkg/deb/init.d/jobmond ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond_${VERSION}-${RELEASE}/etc/init.d
186        install pkg/deb/default/jobmond ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond_${VERSION}-${RELEASE}/etc/default
187        ( cd pkg/deb/jobmond/DEBIAN; \
188        rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php \
189        . ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond_${VERSION}-${RELEASE}/DEBIAN )
190        ( cd ${TMPDIR}/.monarch_buildroot/; cat jobmonarch-jobmond_${VERSION}-${RELEASE}/DEBIAN/control \
191        | sed "s/^Version:.*$//Version: ${VERSION}-${RELEASE}/g" >jobmonarch-jobmond_${VERSION}-${RELEASE}/DEBIAN/control.new; \
192        mv jobmonarch-jobmond_${VERSION}-${RELEASE}/DEBIAN/control.new jobmonarch-jobmond_${VERSION}-${RELEASE}/DEBIAN/control )
193        ( cd ${TMPDIR}/.monarch_buildroot/; ${FAKEROOT} dpkg -b jobmonarch-jobmond_${VERSION}-${RELEASE} )
194        mv ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond_${VERSION}-${RELEASE}.deb ..
195
196clean:
197        rm -rf ${TMPDIR}/.monarch_buildroot
198        rm -rf ./pkg/rpm/jobmonarch.spec
199        rm -rf ./debian
Note: See TracBrowser for help on using the repository browser.