forked from root-project/root
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makedist.sh
executable file
·151 lines (134 loc) · 3.42 KB
/
makedist.sh
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
#!/bin/sh
# $Id$
# Script to produce source distribution and optionally binary distribution
# for VMC packages
# Called by main Makefile.
#
# Usage: fl_makedist.sh -p package [OPTIONS]
# -p package package name: geant3, geant4_vmc, fluka_vmc
# -c gcc_version gcc version
# -b make binary distribution
# -i make installation in the path defined in dedicated
# environment variable
#
# By I.Hrivnacova, 01/04/2010
#set -x
CURDIR=`pwd`
# default options
MAKETAR=1
BINDIST=0
INSTALL=0
GCC_VERS=""
PREFIX=""
while getopts "bic:p:" option
do
case $option in
p ) PACKAGE=$OPTARG;;
c ) GCC_VERS=$OPTARG;;
b ) BINDIST=1
MAKETAR=1
;;
i ) INSTALL=1
MAKETAR=0
;;
* ) echo "Unimplemented option chosen."
echo "Usage:"
echo "makedist.sh -p package [OPTIONS]"
echo " -p package package name: geant3, geant4_vmc, fluka_vmc"
echo " -c gcc_version gcc version"
echo " -b make binary distribution"
echo " -i make installation in path defined in dedicated"
echo " environment variable"
EXIT=1
;;
esac
done
#
# Packages specific definitions:
# run directory, input files, installation destination
#
# geant321_+vmc
#
if [ "x$PACKAGE" = "xgeant321" ]; then
RUNDIR=$CURDIR/..
PREFIX=$G3VMC_INSTALL
DIRNAME="geant3"
# special extension for distribution file name
NAMEEXT="21+_vmc"
BINFILES="geant3/lib"
cd $RUNDIR
MACHINE=`root-config --arch`
SOURCES=`ls geant3`
SOURCES=`echo $SOURCES | sed s/"tgt_$MACHINE"//g`
SOURCES=`echo $SOURCES | sed s/lib//g`
for param in $SOURCES; do
TARFILES="$TARFILES geant3/$param"
done
fi
# geant4_vmc
#
if [ "x$PACKAGE" = "xgeant4vmc" ]; then
RUNDIR=$CURDIR/../..
PREFIX=$G4VMC_INSTALL
DIRNAME="geant4_vmc"
NAMEEXT=""
BINFILES="geant4_vmc/include geant4_vmc/lib"
TARFILES="geant4_vmc/README geant4_vmc/LICENSE geant4_vmc/Makefile \
geant4_vmc/"history" geant4_vmc/Geant4VMC.html geant4_vmc/version_number \
geant4_vmc/g4root geant4_vmc/"source" geant4_vmc/examples"
fi
# fluka_vmc
#
if [ "x$PACKAGE" = "xfluka" ]; then
RUNDIR=$CURDIR/../..
PREFIX=$FLVMC_INSTALL
DIRNAME="fluka_vmc"
NAMEEXT=""
BINFILES="fluka_vmc/lib"
TARFILES="fluka_vmc/README fluka_vmc/"history" fluka_vmc/version_number \
fluka_vmc/input fluka_vmc/"source""
fi
# include binary files if selected
#
if [ "$BINDIST" = "1" ]; then
TARFILES="$TARFILES $BINFILES"
fi
# go to run directory
#
cd $RUNDIR
# make tar ball
#
if [ "$MAKETAR" = "1" ]; then
VERSION=`cat $DIRNAME/version_number`
MACHINE=`root-config --arch`
TYPE=""
if [ "$BINDIST" = "1" ]; then
if [ "x$GCC_VERS" = "x" ]; then
TYPE=$MACHINE.
else
TYPE=$MACHINE.$GCC_VERS.
fi
fi
TARFILE=$DIRNAME$NAMEEXT.$VERSION.$TYPE"tar"
TAR="tar zcvf"
rm -f $TARFILE.gz
TARFILE=$TARFILE".gz"
EXCLUDE="--exclude .svn"
$TAR $TARFILE $EXCLUDE $TARFILES
fi
# make installation
#
if [ "$INSTALL" = "1" ]; then
if [ "x$PREFIX" = "x" ]; then
echo "Destination directory $PREFIX not defined"
EXIT=1
fi
if [ ! -d $PREFIX ]; then
echo "Destination directory $PREFIX not found"
EXIT=1
fi
echo "Installing $DIRNAME in $PREFIX ..."
cp -r $BINFILES $PREFIX
fi
cd $CURDIR
exit 0