source: branches/1.1/Makefile @ 951

Last change on this file since 951 was 951, checked in by ramonb, 6 years ago
  • updated for 1.1.2 release
File size: 6.4 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.2
30RELEASE = 1
31
32REQUIRED = ./jobarchived ./jobmond ./web
33
34all:
35        @echo "Nothing to build."
36        @echo "possible targets are: tarball, tarball-gzip, tarball-bzip, rpm, srpm, deb, clean"
37
38tarball:        tarball-gzip tarball-bzip
39
40$(TMPDIR)/.monarch_buildroot: ${REQUIRED} Makefile
41        @rm -rf ${TMPDIR}/.monarch_buildroot
42        @mkdir -p ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}
43        @( rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php --exclude=svn-commit.tmp \
44        . ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION} )
45        @sed -i -e 's|__VERSION__|$(VERSION)|g' -e 's/__RELEASE__/$(RELEASE)/g' \
46                ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}/jobmond/jobmond.py \
47                ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}/jobarchived/jobarchived.py \
48                ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}/web/addons/job_monarch/version.php \
49                ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}/pkg/rpm/jobmonarch.spec \
50                ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}/debian/changelog
51
52
53tarball-gzip:   $(TMPDIR)/.monarch_buildroot ${REQUIRED}
54        @( cd ${TMPDIR}/.monarch_buildroot; tar zcf $(TMPDIR)/ganglia_jobmonarch-${VERSION}.tar.gz ./ganglia_jobmonarch-${VERSION} )
55        @mv -f ${TMPDIR}/ganglia_jobmonarch-${VERSION}.tar.gz .. 2> /dev/null || true
56        @echo "Wrote: ../ganglia_jobmonarch-${VERSION}.tar.gz"
57
58tarball-bzip:   $(TMPDIR)/.monarch_buildroot ${REQUIRED}
59        @( cd ${TMPDIR}/.monarch_buildroot; tar jcf ${TMPDIR}/ganglia_jobmonarch-${VERSION}.tar.bz2 ./ganglia_jobmonarch-${VERSION} )
60        @mv -f ${TMPDIR}/ganglia_jobmonarch-${VERSION}.tar.bz2 .. 2> /dev/null || true
61        @echo "Wrote: ../ganglia_jobmonarch-${VERSION}.tar.bz2"
62
63rpm: tarball-bzip
64        # Binary package will reflect most distro where ganglia default location is /usr/share/ganglia
65        @LC_ALL=C rpmbuild -tb --define '%custom_web_prefixdir /usr/share/ganglia' ../ganglia_jobmonarch-${VERSION}.tar.bz2|grep "Wrote: "
66
67srpm: tarball-bzip
68        @LC_ALL=C rpmbuild -ts --define '%dist %{nil}' ../ganglia_jobmonarch-${VERSION}.tar.bz2|grep "Wrote: "
69
70deb: ${REQUIRED} $(TMPDIR)/.monarch_buildroot ./debian
71        @( cd ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}; dpkg-buildpackage -b -uc -us )
72        @mv ${TMPDIR}/.monarch_buildroot/jobmonarch-*_$(VERSION)-$(RELEASE)_all.deb ..
73        @rm -rf ${TMPDIR}/.monarch_buildroot
74        @echo "Wrote:"
75        @ls -1 ../jobmonarch*$(VERSION)*.deb
76
77install:  ${REQUIRED}
78        @#
79        @# Set the correct GANGLIA_PATH.
80        @#
81        @echo
82        @echo "Using $(GANGLIA_ROOT) as Ganglia root installation path. If it's not what"
83        @echo "you want, use make GANGLIA_ROOT=/path/to/your/ganglia/root ."
84        @sed -e 's|__GANGLIA_ROOT__|$(GANGLIA_ROOT)/|g' web/conf.php.in > web/addons/job_monarch/conf.php
85        @#
86        @# Set the correct JOBARCHIVE_RRDS in jobarchve.conf and ganglia conf.php
87        @#
88        @echo
89        @echo "Using $(JOBARCHIVE_RRDS) as jobarchive path to  store rrds files. If it's not what"
90        @echo "you want, use make JOBARCHIVE_RRDS=/path/to/you/jobarchived/rrdsfiles ."
91        @sed -i -e 's|__JOBARCHIVE_RRDS__|$(JOBARCHIVE_RRDS)|g' jobarchived/jobarchived.conf web/addons/job_monarch/conf.php
92        @#
93        @# Files in SBIN_DIR
94        @#
95        @echo
96        @echo "Installing jobmond.py and jobarchived.py to $(PREFIX)/sbin"
97        @install -m 0755 -d $(DESTDIR)$(PREFIX)/sbin
98        @install -m 0755 jobmond/jobmond.py $(DESTDIR)$(PREFIX)/sbin/
99        @install -m 0755 jobarchived/jobarchived.py $(DESTDIR)$(PREFIX)/sbin/
100        @(cd $(DESTDIR)$(PREFIX)/sbin/; ln -s jobmond.py jobmond; ln -s jobarchived.py jobarchived)
101        @#
102        @# Files in /etc
103        @#
104        @echo
105        @echo "Installing config files jobmond.conf jobarchived.conf in /etc"
106        @install -m 0755 -d $(DESTDIR)/etc
107        @install -m 0644 jobmond/jobmond.conf $(DESTDIR)/etc/
108        @install -m 0644 jobarchived/jobarchived.conf $(DESTDIR)/etc/
109        @#
110        @# Files specific to distros if /etc/redhat-release => rpm else (/etc/debian_version => debian)
111        @#
112        @if test -r /etc/redhat-release; then \
113                echo; \
114                echo "Red Hat detected: installing RPM service files in /etc"; \
115                sed -i -e 's|DAEMON=.*|DAEMON=$(JOBMOND)|g' pkg/rpm/init.d/jobmond; \
116                sed -i -e 's|DAEMON=.*|DAEMON=$(JOBARCHIVED)|g' pkg/rpm/init.d/jobarchived; \
117                install -m 0755 -d $(DESTDIR)/etc/rc.d/init.d; \
118                install -m 0755 pkg/rpm/init.d/jobmond $(DESTDIR)/etc/rc.d/init.d/; \
119                install -m 0755 pkg/rpm/init.d/jobarchived $(DESTDIR)/etc/rc.d/init.d/; \
120                install -m 0755 -d $(DESTDIR)/etc/sysconfig; \
121                install -m 0755 pkg/rpm/sysconfig/jobmond $(DESTDIR)/etc/sysconfig; \
122                install -m 0755 pkg/rpm/sysconfig/jobarchived $(DESTDIR)/etc/sysconfig; \
123    else \
124                sed -i -e 's|DAEMON=.*|DAEMON=$(JOBMOND)|g' debian/jobmonarch-jobmond.init; \
125                sed -i -e 's|DAEMON=.*|DAEMON=$(JOBARCHIVED)|g' debian/jobmonarch-jobarchived.init; \
126        fi
127        @#
128        @# Files in /usr/share
129        @#
130        @echo
131        @echo "Installing job_dbase.sql in $(PREFIX)/share/jobarchived"
132        @install -m 0755 -d $(DESTDIR)$(PREFIX)/share/jobarchived
133        @install -m 0755 jobarchived/job_dbase.sql $(DESTDIR)$(PREFIX)/share/jobarchived/
134        @#
135        @# Create the /var/lib/jobarchive directory where rrds are stored.
136        @#
137        @echo
138        @echo "Creating the directory where RRDs will be stored: $(JOBARCHIVE_RRDS)"
139        @install -m 0755 -d $(DESTDIR)$(JOBARCHIVE_RRDS)
140        @#
141        @# Files for ganglia
142        @#
143        @echo
144        @echo "Installing Ganglia web interface to $(GANGLIA_ROOT) ."
145        @install -m 0755 -d $(DESTDIR)$(GANGLIA_ROOT)
146        @chown -R $(GANGLIA_USER) ./web
147        @chown $(HTTPD_USER) ./web/addons/job_monarch/dwoo/compiled
148        @chown $(HTTPD_USER) ./web/addons/job_monarch/dwoo/cache
149        @chmod 775 ./web/addons/job_monarch/dwoo/cache
150        @(cd web; rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php ./addons ./templates $(DESTDIR)$(GANGLIA_ROOT)/)
151        @#
152        @echo
153        @echo "Installation complete."
154        @echo
155
156clean:
157        @(cd ./debian; rm -rf files *.log *.substvars jobmonarch/ jobmonarch-jobmond/ jobmonarch-jobarchived/ jobmonarch-webfrontend/ tmp/)
158        @rm -f web/addons/job_monarch/conf.php
159
160clean_all:      clean
161        @# Cannot include this in clean otherwise, dpkg-buildpackage will commit scuicide.
162        @rm -rf ${TMPDIR}/.monarch_buildroot
163
Note: See TracBrowser for help on using the repository browser.