create_distribution_nmxptool.sh 2.42 KB
Newer Older
Matteo Quintiliani's avatar
Start    
Matteo Quintiliani committed
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
#!/bin/sh

if [ -z $1 ]; then
    echo "Syntax: `basename $0` <version> [<output_directory>]"
    exit
fi

VERSION=$1

if [ -z $2 ]; then
    DIRBASERELATIVE=`dirname $0`
    cd $DIRBASERELATIVE
    DIRBASE=`pwd`
    cd -
else
    if [ -d $2 ]; then
	DIRBASE=$2
    else
	echo "$2 is not a directory!"
	exit
    fi
fi

echo "DIRBASE = $DIRBASE"

DIRMODULE=nmxptool
DIRSOURCE=nmxptool
DIRSOURCEVERSION=$DIRSOURCE-$VERSION
Matteo Quintiliani's avatar
Matteo Quintiliani committed
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
CVSTAGVERSION=`echo $DIRMODULE-$VERSION | sed -e "s/[\.-]/_/g"`

if [ -z $CVSWORK ]; then
    echo "WARNING: CVSWORK is not defined and will be set to the current directory!"
    CVSWORK=`pwd`
fi

CVSDIRBASE=$CVSWORK
CVSDIRMODULE=$CVSWORK/$DIRMODULE

if [ ! -d $CVSDIRMODULE ]; then
    echo "ERROR: $CVSDIRMODULE is not a directory!"
    exit
fi

echo "CVSTAGVERSION = $CVSTAGVERSION"

printf "Do you want execute 'cvs tag $CVSTAGVERSION' from directory $CVSDIRMODULE ? [ y/n ] "
EXECVSTAG=x
while [ $EXECVSTAG != y ]  &&  [ $EXECVSTAG != n ] && [ $EXECVSTAG != Y ]  &&  [ $EXECVSTAG != N ]; do
    read -s -n 1 -a EXECVSTAG
done
echo ""
echo "EXECVSTAG = $EXECVSTAG"
if [ $EXECVSTAG == y ]; then
    CURDIR=`pwd`
    cd $CVSDIRMODULE  &&  cvs tag $CVSTAGVERSION
    cd $CURDIR
fi
Matteo Quintiliani's avatar
Start    
Matteo Quintiliani committed
58
59
60
61
62
63
64
65
66

DIRTMP=/tmp/casa

rm -fr $DIRTMP

mkdir $DIRTMP

cd $DIRTMP

Matteo Quintiliani's avatar
Matteo Quintiliani committed
67
cvs export -r $CVSTAGVERSION $DIRMODULE  ||  exit
Matteo Quintiliani's avatar
Start    
Matteo Quintiliani committed
68
69
70
71
72
73

mv $DIRMODULE $DIRSOURCEVERSION

for DIRECTORY in $DIRSOURCEVERSION/libnmxp $DIRSOURCEVERSION ; do
    cd $DIRECTORY
    rm -fr `find . -name CVS`
Matteo Quintiliani's avatar
Matteo Quintiliani committed
74
    echo "Compiling $DIRECTORY"
Matteo Quintiliani's avatar
Start    
Matteo Quintiliani committed
75
76
77
    ./bootstrap
    mv configure configure.old
    cat configure.old | sed -e "s/^\(#define malloc rpl_malloc\)/\/\/ mtheo removed for solaris  \1/" > configure
Matteo Quintiliani's avatar
Matteo Quintiliani committed
78
    rm configure.old
Matteo Quintiliani's avatar
Start    
Matteo Quintiliani committed
79
80
81
    chmod 755 configure
    ./configure
    make
Matteo Quintiliani's avatar
Matteo Quintiliani committed
82
83
84
85
86
87
    cd -
done

for DIRECTORY in $DIRSOURCEVERSION/libnmxp $DIRSOURCEVERSION ; do
    cd $DIRECTORY
    echo "Cleaning $DIRECTORY"
Matteo Quintiliani's avatar
Start    
Matteo Quintiliani committed
88
89
    make clean
    make distclean
Matteo Quintiliani's avatar
Matteo Quintiliani committed
90
    rm bootstrap
Matteo Quintiliani's avatar
Start    
Matteo Quintiliani committed
91
92
93
94
95
96
97
    if [ -f Doxyfile ]; then
	doxygen
	rm Doxyfile
    fi
    cd -
done

98
99
100
101
102
103
104
105
106
# link to the earthworm makefiles
EWMAKEFILESOL=earthworm/makefile.ux.nognu
EWMAKEFILEUX=earthworm/makefile.ux.nognu
cd $DIRSOURCEVERSION
ln -s $EWMAKEFILESOL makefile.sol
ln -s $EWMAKEFILEUX makefile.ux
cd -


Matteo Quintiliani's avatar
Start    
Matteo Quintiliani committed
107
rm -f `find . -iname "*~"`
108
109
110
rm -fr $DIRSOURCEVERSION/libnmxp/doc/rapporto_tecnico_ingv_nmxp.*
rm -fr $DIRSOURCEVERSION/libnmxp/doc/nanometrics_naqs_and_data.graffle
rm -fr $DIRSOURCEVERSION/no_dist
Matteo Quintiliani's avatar
Start    
Matteo Quintiliani committed
111
112
113
114
115

tar cvfz $DIRSOURCEVERSION.tar.gz $DIRSOURCEVERSION

mv $DIRSOURCEVERSION.tar.gz $DIRBASE/