source: branches/1.0/Makefile @ 846

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

Debianized jobmonarch

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
56rpm: tarball-bzip
57        rpmbuild -tb ../ganglia_jobmonarch-${VERSION}.tar.bz2
58
59srpm: tarball-bzip
60        rpmbuild -ts --define '%dist %{nil}' ../ganglia_jobmonarch-${VERSION}.tar.bz2
61
62deb: ${REQUIRED} ./debian
63        # FIXME set $(VERSION)-$(RELEASE) in ./debian/changelog
64        dpkg-buildpackage -b -uc -us
65
66install:
67        @#
68        @# Set the correct GANGLIA_PATH.
69        @#
70        @echo "\nUsing $(GANGLIA_ROOT) as Ganglia root installation path. If it's not what"
71        @echo "you want, use make GANGLIA_ROOT=/path/to/your/ganglia/root ."
72        @sed -i -e 's|/var/www/ganglia/|$(GANGLIA_ROOT)/|g' web/addons/job_monarch/conf.php
73        @#
74        @# Set the correct JOBARCHIVE_RRDS in jobarchve.conf and ganglia conf.php
75        @#
76        @echo "\nUsing $(JOBARCHIVE_RRDS) as jobarchive path to  store rrds files. If it's not what"
77        @echo "you want, use make JOBARCHIVE_RRDS=/path/to/you/jobarchived/rrdsfiles ."
78        @sed -i -e 's|/var/lib/jobarchive|$(JOBARCHIVE_RRDS)|g' jobarchived/jobarchived.conf web/addons/job_monarch/conf.php
79        @#
80        @# Files in SBIN_DIR
81        @#
82        @echo "\nInstalling jobmond.py and jobarchived.py to $(PREFIX)/sbin"
83        @install -m 0755 -d $(DESTDIR)$(PREFIX)/sbin
84        @install -m 0755 jobmond/jobmond.py $(DESTDIR)$(PREFIX)/sbin/
85        @install -m 0755 jobarchived/jobarchived.py $(DESTDIR)$(PREFIX)/sbin/
86        @(cd $(DESTDIR)$(PREFIX)/sbin/; ln -s jobmond.py jobmond; ln -s jobarchived.py jobarchived)
87        @#
88        @# Files specific to distros if /etc/sysconfig => rpm else (/etc/default => debian)
89        @#
90        @echo "\nInstalling service files in $(DESTDIR)/etc"
91        @if test -d /etc/sysconfig; then \
92                install -m 0755 -d $(DESTDIR)/etc/rc.d/init.d; \
93                install -m 0755 pkg/rpm/init.d/jobmond $(DESTDIR)/etc/rc.d/init.d/; \
94                install -m 0755 pkg/rpm/init.d/jobarchived $(DESTDIR)/etc/rc.d/init.d/; \
95                install -m 0755 -d $(DESTDIR)/etc/sysconfig; \
96                install -m 0755 pkg/rpm/sysconfig/jobmond $(DESTDIR)/etc/sysconfig; \
97                install -m 0755 pkg/rpm/sysconfig/jobarchived $(DESTDIR)/etc/sysconfig; \
98        else \
99                install -m 0755 -d $(DESTDIR)/etc/init.d; \
100                install -m 0755 pkg/deb/init.d/jobmond $(DESTDIR)/etc/init.d/; \
101                install -m 0755 pkg/deb/init.d/jobarchived $(DESTDIR)/etc/init.d/; \
102                install -m 0755 -d $(DESTDIR)/etc/default; \
103                install -m 0755 pkg/deb/default/jobmond $(DESTDIR)/etc/default; \
104                install -m 0755 pkg/deb/default/jobarchived $(DESTDIR)/etc/default; \
105        fi
106        @#
107        @# Files in /etc
108        @#
109        @echo "\nInstalling config files jobmond.conf jobarchived.conf in $(DESTDIR)/etc"
110        @install -m 0644 jobmond/jobmond.conf $(DESTDIR)/etc
111        @install -m 0644 jobarchived/jobarchived.conf $(DESTDIR)/etc
112        @#
113        @# Files in /usr/share
114        @#
115        @echo "\nInstalling job_dbase.sql in $(PREFIX)/share/jobarchived"
116        @install -m 0755 -d $(DESTDIR)$(PREFIX)/share/jobarchived
117        @install -m 0755 jobarchived/job_dbase.sql $(DESTDIR)$(PREFIX)/share/jobarchived/
118        @#
119        @# Create the /var/lib/jobarchive directory where rrds are stored.
120        @#
121        @echo "\nCreating the directory where RRDs will be stored: $(JOBARCHIVE_RRDS)"
122        @install -m 0755 -d $(DESTDIR)$(JOBARCHIVE_RRDS)
123        @#
124        @# Files for ganglia
125        @#
126        @echo "\nInstalling Ganglia web interface to $(GANGLIA_ROOT) ."
127        @install -m 0755 -d $(DESTDIR)$(GANGLIA_ROOT)
128        @chown -R $(GANGLIA_USER) ./web
129        @chown $(HTTPD_USER) ./web/addons/job_monarch/dwoo/compiled
130        @(cd web; rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php . $(DESTDIR)$(GANGLIA_ROOT)/)
131        @#
132        @echo "\nInstallation complete.\n"
133
134deb-webfrontend:        ${REQUIRED}
135        mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-webfrontend_${VERSION}-${RELEASE}/DEBIAN >/dev/null
136        mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-webfrontend_${VERSION}-${RELEASE}/${GANGLIA_ROOT} >/dev/null
137        ( cd web; rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php \
138        . ${TMPDIR}/.monarch_buildroot/jobmonarch-webfrontend_${VERSION}-${RELEASE}/${GANGLIA_ROOT} )
139        ( cd pkg/deb/web/DEBIAN; \
140        rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php \
141        . ${TMPDIR}/.monarch_buildroot/jobmonarch-webfrontend_${VERSION}-${RELEASE}/DEBIAN )
142        ( cd ${TMPDIR}/.monarch_buildroot/; cat jobmonarch-webfrontend_${VERSION}-${RELEASE}/DEBIAN/control \
143        | sed "s/^Version:.*$//Version: ${VERSION}-${RELEASE}/g" >jobmonarch-webfrontend_${VERSION}-${RELEASE}/DEBIAN/control.new; \
144        mv jobmonarch-webfrontend_${VERSION}-${RELEASE}/DEBIAN/control.new \
145        jobmonarch-webfrontend_${VERSION}-${RELEASE}/DEBIAN/control )
146        ( cd ${TMPDIR}/.monarch_buildroot/; ${FAKEROOT} dpkg -b jobmonarch-webfrontend_${VERSION}-${RELEASE} )
147        mv ${TMPDIR}/.monarch_buildroot/jobmonarch-webfrontend_${VERSION}-${RELEASE}.deb ..
148
149deb-jobarchived:        ${REQUIRED}
150        mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}/DEBIAN >/dev/null
151        mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}/etc/init.d >/dev/null
152        mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}/etc/default >/dev/null
153        mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}/usr/sbin >/dev/null
154        mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}/usr/share/jobarchived >/dev/null
155        install -m 755 jobarchived/jobarchived.py ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}/usr/sbin
156        ( cd ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}/usr/sbin; \
157        ln -s jobarchived.py jobarchived || true)
158        install jobarchived/jobarchived.conf ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}/etc
159        install pkg/deb/init.d/jobarchived ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}/etc/init.d
160        install pkg/deb/default/jobarchived ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}/etc/default
161        install jobarchived/job_dbase.sql \
162        ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}/usr/share/jobarchived
163        ( cd pkg/deb/jobarchived/DEBIAN; \
164        rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php \
165        . ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}/DEBIAN )
166        ( cd ${TMPDIR}/.monarch_buildroot/; cat jobmonarch-jobarchived_${VERSION}-${RELEASE}/DEBIAN/control \
167        | sed "s/^Version:.*$//Version: ${VERSION}-${RELEASE}/g" >jobmonarch-jobarchived_${VERSION}-${RELEASE}/DEBIAN/control.new; \
168        mv jobmonarch-jobarchived_${VERSION}-${RELEASE}/DEBIAN/control.new \
169        jobmonarch-jobarchived_${VERSION}-${RELEASE}/DEBIAN/control )
170        ( cd ${TMPDIR}/.monarch_buildroot/; ${FAKEROOT} dpkg -b jobmonarch-jobarchived_${VERSION}-${RELEASE} )
171        mv ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}.deb ..
172
173deb-jobmond:    ${REQUIRED}
174        mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond_${VERSION}-${RELEASE}/DEBIAN >/dev/null
175        mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond_${VERSION}-${RELEASE}/etc/init.d >/dev/null
176        mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond_${VERSION}-${RELEASE}/etc/default >/dev/null
177        mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond_${VERSION}-${RELEASE}/usr/sbin >/dev/null
178        install -m 755 jobmond/jobmond.py ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond_${VERSION}-${RELEASE}/usr/sbin
179        ( cd ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond_${VERSION}-${RELEASE}/usr/sbin; \
180        ln -s jobmond.py jobmond || true)
181        install jobmond/jobmond.conf ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond_${VERSION}-${RELEASE}/etc
182        install pkg/deb/init.d/jobmond ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond_${VERSION}-${RELEASE}/etc/init.d
183        install pkg/deb/default/jobmond ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond_${VERSION}-${RELEASE}/etc/default
184        ( cd pkg/deb/jobmond/DEBIAN; \
185        rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php \
186        . ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond_${VERSION}-${RELEASE}/DEBIAN )
187        ( cd ${TMPDIR}/.monarch_buildroot/; cat jobmonarch-jobmond_${VERSION}-${RELEASE}/DEBIAN/control \
188        | sed "s/^Version:.*$//Version: ${VERSION}-${RELEASE}/g" >jobmonarch-jobmond_${VERSION}-${RELEASE}/DEBIAN/control.new; \
189        mv jobmonarch-jobmond_${VERSION}-${RELEASE}/DEBIAN/control.new jobmonarch-jobmond_${VERSION}-${RELEASE}/DEBIAN/control )
190        ( cd ${TMPDIR}/.monarch_buildroot/; ${FAKEROOT} dpkg -b jobmonarch-jobmond_${VERSION}-${RELEASE} )
191        mv ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond_${VERSION}-${RELEASE}.deb ..
192
193clean:
194        rm -rf ${TMPDIR}/.monarch_buildroot
195        rm -rf ./pkg/rpm/jobmonarch.spec
196        rm -rf ./debian/{files,*.log,jobmonarch-jobmond/,jobmonarch-jobarchived/,jobmonarch-webfrontend/,tmp/}
Note: See TracBrowser for help on using the repository browser.