source: branches/1.0/Makefile @ 841

Last change on this file since 841 was 841, checked in by olahaye, 10 years ago

[Makefile/rpm packaging] Reworked rpm packaging. Still need to fix %post for
systemd enabled system (normal script hangs).

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