1 |
#!/bin/bash |
2 |
|
3 |
#This script produced with the aid of "The Debian System concepts and techniques" By Martin F. Krafft |
4 |
# Its purpose is to produce a .deb for escript |
5 |
|
6 |
SRCDIR=`pwd` |
7 |
WRAPPERNAME=escript |
8 |
ALTWRAPPERNAME=finleypython |
9 |
OUTPUTROOT=$SRCDIR/build/package/lenny/escript |
10 |
LIBOUT=$OUTPUTROOT/usr/lib/escript |
11 |
BINOUT=$OUTPUTROOT/usr/bin |
12 |
PKGFILES=$SRCDIR/packaging/lenny |
13 |
|
14 |
# check to be sure we are running from the project root and that we look like the root user |
15 |
|
16 |
if [ `whoami` != 'root' ] |
17 |
then |
18 |
echo "Please execute this script under fakeroot." |
19 |
echo "fakeroot $0" |
20 |
exit 1 |
21 |
fi |
22 |
|
23 |
if [ ! -d escript/src ] |
24 |
then |
25 |
echo "Please execute this script from the root of the project" |
26 |
exit 3 |
27 |
fi |
28 |
|
29 |
if [ -d $OUTPUTROOT ] |
30 |
then |
31 |
rm -rf $OUTPUTROOT || (echo "Error could not clean build area";exit 2) |
32 |
fi |
33 |
|
34 |
mkdir -p $OUTPUTROOT |
35 |
|
36 |
#First copy debian skeleton |
37 |
cp -r $PKGFILES/escript/* $OUTPUTROOT |
38 |
|
39 |
|
40 |
mkdir -p $OUTPUTROOT/usr/share/man/man1 |
41 |
|
42 |
#copy the man page |
43 |
cp $SRCDIR/doc/manpage/$WRAPPERNAME.1 $OUTPUTROOT/usr/share/man/man1 |
44 |
cp $SRCDIR/doc/manpage/$WRAPPERNAME.1 $OUTPUTROOT/usr/share/man/man1/$ALTWRAPPERNAME.1 |
45 |
gzip $OUTPUTROOT/usr/share/man/man1/$WRAPPERNAME.1 |
46 |
gzip $OUTPUTROOT/usr/share/man/man1/$ALTWRAPPERNAME.1 |
47 |
|
48 |
#copy the documentation |
49 |
cp $SRCDIR/release/doc/escript_examples.tar.gz $OUTPUTROOT/usr/share/doc/escript/ |
50 |
cp $SRCDIR/release/doc/install/install.pdf $OUTPUTROOT/usr/share/doc/escript |
51 |
cp $SRCDIR/release/doc/user/guide.pdf $OUTPUTROOT/usr/share/doc/escript |
52 |
cp -r $SRCDIR/release/doc/epydoc $OUTPUTROOT/usr/share/doc/escript/python_html |
53 |
|
54 |
mkdir -p $LIBOUT/lib |
55 |
mkdir -p $BINOUT |
56 |
#Should be using install here? |
57 |
cp $SRCDIR/lib/libescript.so $SRCDIR/lib/libfinley.so $LIBOUT/lib |
58 |
cp -r $SRCDIR/esys $LIBOUT |
59 |
|
60 |
# content from finley_wrapper_writer.sh |
61 |
# Not calling the original script because it polutes the environment eg explicit python path |
62 |
|
63 |
# We should be using the standard python |
64 |
export PYTHON_CMD=python |
65 |
export ESCRIPT_ROOT=/usr/lib/escript |
66 |
|
67 |
sed -e "s%@@ESCRIPT_ROOT@@%$ESCRIPT_ROOT%" \ |
68 |
-e "s%@@LD_LIBRARY_PATH@@%\$ESCRIPT_ROOT/lib:\$LD_LIBRARY_PATH%" \ |
69 |
-e "s%@@PYTHONPATH@@%\$ESCRIPT_ROOT:\$PYTHONPATH%" \ |
70 |
-e "s%@@PYTHON_CMD@@%$PYTHON_CMD%" \ |
71 |
-e "s%@@PATH@@%\$PATH%" \ |
72 |
< $SRCDIR/scripts/finley_wrapper_template > $BINOUT/$WRAPPERNAME |
73 |
|
74 |
#end content from finley_wrapper_writer.sh |
75 |
|
76 |
cd $BINOUT |
77 |
ln -s $WRAPPERNAME $ALTWRAPPERNAME |
78 |
cd $SRCDIR |
79 |
|
80 |
#Nuke any svn stuff that made it in |
81 |
find $OUTPUTROOT -name ".svn" | xargs rm -rf |
82 |
|
83 |
|
84 |
#Say what version of debian packaging we are using: |
85 |
echo 2.0 > $OUTPUTROOT/../debian-binary |
86 |
|
87 |
#Check some permissions |
88 |
chmod og=rx $BINOUT/$WRAPPERNAME |
89 |
if [ -f $LIBOUT/pythonMPI ] |
90 |
then |
91 |
chmod og=rx $LIBOUT/pythonMPI |
92 |
fi |
93 |
|
94 |
cd $OUTPUTROOT |
95 |
|
96 |
cd usr/share/doc/escript/ |
97 |
gzip changelog.Debian |
98 |
|
99 |
cd $OUTPUTROOT |
100 |
#Fix directory perms |
101 |
chmod -R og-w . |
102 |
|
103 |
cd DEBIAN |
104 |
tar czf control.tar.gz . |
105 |
mv control.tar.gz ../../ |
106 |
cd .. |
107 |
tar czf data.tar.gz usr |
108 |
mv data.tar.gz .. |
109 |
cd .. |
110 |
|
111 |
ar rcu escript.deb debian-binary control.tar.gz data.tar.gz |
112 |
|
113 |
|
114 |
|
115 |
|