forked from OpenSpeedShop/openspeedshop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
do_build
executable file
·222 lines (192 loc) · 8.67 KB
/
do_build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
#!/bin/ksh
################################################################################
# Copyright (c) 2005 Silicon Graphics, Inc. All Rights Reserved.
# Copyright (c) 2006-2010 Krell Institute. All Rights Reserved.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA
################################################################################
#set -x
# get complete path to this script (path include this filename)
HERE=`which $0`
# now remove everything after and including last / (just the path)
MYCURRENT=${HERE%/*}
# directory above MYCURRENT
TOPLEVEL=${MYCURRENT%/*}
# install the build from the workarea here if OPENSS_PREFIX is not set:
export MYOSSINSTALLDIR=$TOPLEVEL/OpensSpeedShop/usr
if [ "$OPENSS_PREFIX" = "" ] ; then
echo "NOTE: OPENSS_PREFIX not set."
echo "NOTE: Defaulting to $MYOSSINSTALLDIR ..."
export OPENSS_PREFIX=$MYOSSINSTALLDIR
else
echo "OPENSS_PREFIX is set: $OPENSS_PREFIX"
fi
echo
echo "$0: configure workarea build/install using:"
echo "configure --prefix=$OPENSS_PREFIX"
if test "$1" == "" ; then
echo "$0: Running build in $MYCURRENT"
# prepare workarea to be configured
# echo "$0: Running bootstrap"
# ./bootstrap;
# configure the workarea build
echo "$0: Running configure --prefix=$OPENSS_PREFIX --with-instrumentor=mrnet --with-libdwarf=$OPENSS_PREFIX --with-binutils=/usr --with-libunwind=$OPENSS_PREFIX --with-papi=$OPENSS_PREFIX --with-sqlite=$OPENSS_PREFIX --with-qtlib=$QTLIB --with-dyninst=$OPENSS_PREFIX --with-dpcl=$OPENSS_PREFIX --with-lampi=$OPENSS_MPI_LAMPI --with-openmpi=$OPENSS_MPI_OPENMPI --with-mpt=$OPENSS_MPI_MPT --with-mpich=$OPENSS_MPI_MPICH --with-mpich2=$OPENSS_MPI_MPICH2 --with-mvapich=$OPENSS_MPI_MVAPICH --with-mvapich2=$OPENSS_MPI_MVAPICH2 --with-lam=$OPENSS_MPI_LAM --with-mpich-driver= --with-otf=$OPENSS_PREFIX --with-vt=$OPENSS_PREFIX --with-libmonitor=$OPENSS_PREFIX --with-mrnet=$OPENSS_PREFIX"
./configure --prefix=$OPENSS_PREFIX --with-instrumentor=mrnet --with-libdwarf=$OPENSS_PREFIX --with-binutils=/usr --with-libunwind=$OPENSS_PREFIX --with-papi=$OPENSS_PREFIX --with-sqlite=$OPENSS_PREFIX --with-qtlib=$QTLIB --with-dyninst=$OPENSS_PREFIX --with-dpcl=$OPENSS_PREFIX --with-lampi=$OPENSS_MPI_LAMPI --with-openmpi=$OPENSS_MPI_OPENMPI --with-mpt=$OPENSS_MPI_MPT --with-mpich=$OPENSS_MPI_MPICH --with-mpich2=$OPENSS_MPI_MPICH2 --with-mvapich=$OPENSS_MPI_MVAPICH --with-mvapich2=$OPENSS_MPI_MVAPICH2 --with-lam=$OPENSS_MPI_LAM --with-mpich-driver= --with-otf=$OPENSS_PREFIX --with-vt=$OPENSS_PREFIX --with-libmonitor=$OPENSS_PREFIX --with-mrnet=$OPENSS_PREFIX
# clean up any previous build
echo "$0: Running make clean"
make clean
# clean up any previous install
echo "$0: Running make uninstall"
make uninstall
# build and install from the configured workarea source
echo "$0: Running make install"
make install
# remove any existing tarball from a previous build.
# create the tarball. rpmbuild performs a complete configure,
# build, install from the tarball sources. If everything goes fine,
# then source and binary rpm packages are created.
echo "$0: Removing previous openspeedshop-2.0.0.tar.gz"
rm -f openspeedshop-2.0.0.tar.gz
echo "$0: Running make dist"
make dist
fi
# ensure we have a valid tarball before proceeding.
#
cd $MYCURRENT
if [ -f openspeedshop-2.0.0.tar.gz ] ; then
echo $0: tarball openspeedshop-2.0.0.tar.gz created successfully.
else
echo $0 ERROR: no openspeedshop-2.0.0.tar.gz exists. Build of tarball failed
echo $0 ERROR: can not perform rpmbuild. exiting...
exit 1
fi
#############################################################################
# At this point, the tarball has been generated in OpenSpeedShop (%{_topdir}).
# If there were no errors, OpenSpeedShop/openspeedshop-2.0.0.tar.gz
# should exist. The next step configures, builds and installs your tarball as
# a user would and then creates rpm packages. The rpmbuild command
# reads OpenSpeedShop/openspeedshop-2.0.0.spec which controls the
# configure/build/install. The openspeedshop-2.0.0.spec file is aware
# of the $QTDIR environment variable.
# Please review openspeedshop-2.0.0.spec
# for the details. The key configuration directories are:
#
# %{_topdir}/../RPM
# directory where all rpm related work is performed.
# This can be changed to /tmp or made an option if desired.
#
# %{_topdir}/../RPM/BUILD
# directory where tarball is expanded and built.
#
# %{_topdir}/../rpminstall
# The above expands to %{_topdir}/../rpminstall and the spec file
# uses %{_topdir}/../rpminstall for $RPM_BUILD_ROOT.
# The openspeedshop-2.0.0.spec configures the build to use:
# configure --prefix=$RPM_BUILD_ROOT/usr
# Setting your environment (i.e. PATH, LD_LIBRARY_PATH,OPENSS_PLUGIN_PATH)
# to this installation allows you to test the software that
# a user would build (not the software in you workare build).
# i.e. $RPM_BUILD_ROOT/usr is the $OPENSS_PREFIX
# for the software built from the tarball.
##############################################################################
cd $MYCURRENT
# prepare to build the rpm packages in the RPM directory
# in the users TOPLEVEL (i.e. workarea) directory.
# (this is %{_topdir} in the specfile)
#
RPMBUILDDIR=$TOPLEVEL/RPM
# create local rpmmacros file used by rpmbuild to control the
# build, install of the tarball source and creation rpm packages.
# This overides the users $HOME/.rpmmacros file if it exists
# since this is specific to this instance of the OSS software
# in this specific OpenSpeedShop cvs tree.
#
RPMMACROSFILES=$MYCURRENT/RPMMACROS
rm -f $RPMMACROSFILES
cat << EOF > $RPMMACROSFILES
#! /bin/ksh
%_topdir $RPMBUILDDIR
%_prefix /usr
%_exec_prefix %{_prefix}
%_bindir %{_exec_prefix}/bin
%_sbindir %{_exec_prefix}/sbin
%_libexecdir %{_exec_prefix}/libexec
%_datadir %{_prefix}/share
%_sysconfdir %{_prefix}/etc
%_sharedstatedir %{_prefix}/com
%_localstatedir %{_prefix}/var
%_libdir %{_exec_prefix}/lib
%_includedir %{_prefix}/include
%_infodir %{_prefix}/info
%_mandir %{_prefix}/man
%_defaultdocdir %{_prefix}/share/doc/packages/OpenSpeedShop
# do not generate debugging packages by default
%debug_package %{nil}
EOF
# create local rpmrc file used by rpmbuild to control the
# build, install of the tarball source and creation rpm packages.
# This rpmrc file adds our $RPMMACROSFILE to the rpmbuild macro
# file search list. Used as the --rpmrc argument for rpmbuild.
#
RPMRCFILE=$MYCURRENT/RPMRC
rm -f $MYCURRENT/RPMRC
cat << EOF > $RPMRCFILE
#! /bin/ksh
macrofiles: /usr/lib/rpm/macros:/usr/lib/rpm/%{_target}/macros:/etc/rpm/macros.specspo:/etc/rpm/macros.prelink:/etc/rpm/macros.solve:/etc/rpm/macros.up2date:/etc/rpm/macros:/etc/rpm/%{_target}/macros:$RPMMACROSFILES
EOF
if [ ! -d $RPMBUILDDIR ] ; then
mkdir -p $RPMBUILDDIR
fi
if [ ! -d $RPMBUILDDIR/SOURCES ] ; then
mkdir -p $RPMBUILDDIR/SOURCES
else
rm -f $RPMBUILDDIR/SOURCES/*
fi
if [ ! -d $RPMBUILDDIR/BUILD ] ; then
mkdir -p $RPMBUILDDIR/BUILD
else
rm -rf $RPMBUILDDIR/BUILD/*
fi
if [ ! -d $RPMBUILDDIR/RPMS ] ; then
mkdir -p $RPMBUILDDIR/RPMS
else
rm -rf $RPMBUILDDIR/RPMS/*
fi
if [ ! -d $RPMBUILDDIR/SRPMS ] ; then
mkdir -p $RPMBUILDDIR/SRPMS
else
rm -rf $RPMBUILDDIR/SRPMS/*
fi
if [ ! -d $RPMBUILDDIR/SPECS ] ; then
mkdir -p $RPMBUILDDIR/SPECS
else
rm -rf $RPMBUILDDIR/SPECS/*
fi
# copy the tarball to the direcotry rpmbuild expects.
#
rm -f $RPMBUILDDIR/SOURCES/openspeedshop-2.0.0.tar.gz
cp openspeedshop-2.0.0.tar.gz $RPMBUILDDIR/SOURCES
# Fire off the build and install of the tarball source using
# the current spec file. This will build the source an binary
# rpm packages (-ba -> build all) if the tarball source builds
# and install succesfully.
#
# NOTE: any errors in config/build/install of the tarball
# will prevent the rpm packages from being generated.
# This step allows developers to verify that any changes
# they make to the product will build for a user of the tarball.
#
echo "$0: Invoking rpmbuild --rcfile=$RPMRCFILE -ba -v openspeedshop-2.0.0.spec"
rpmbuild --verbose --define "depend_prefix /usr" --define "openss_instrumentor mrnet" --rcfile=$RPMRCFILE -ba -v openspeedshop-2.0.0.spec