summaryrefslogtreecommitdiff
path: root/binary/linux-gnu/build-dist
blob: 6d8c179cb1ab2725356a6460ad509e4a2c4492ee (plain)
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
#! /usr/bin/env bash

# Create ODB compiler Linux distribution.
#
# -rebuild
# -arch
# -libexecdir
#
trap 'exit 1' ERR

function error ()
{
  echo "$*" 1>&2
}

rebuild=n

arch=x86_64-linux-gnu
libexecdir=lib
rebuild=n

while [ $# -gt 0 ]; do
  case $1 in
    -rebuild)
      rebuild=y
      shift
      ;;
    -arch)
      shift
      arch=$1
      shift
      ;;
    -libexecdir)
      shift
      libexecdir=$1
      shift
      ;;
    *)
      error "unknown option: $1"
      exit 1
      ;;
  esac
done

wd=`pwd`
cpu=`echo $arch | sed -e 's/^\([^-]*\)-.*$/\1/'`

cver=`echo libcutl-?.*.tar.gz | sed -e "s%libcutl-\(.*\).tar.gz%\1%"`
over=`echo odb-?.*.tar.gz | sed -e "s%odb-\(.*\).tar.gz%\1%"`
mver=`echo $over | sed -e 's%\([0-9]*\.[0-9]*\).*%\1%'`

install_root="/tmp/odb-$over-$cpu-linux-gnu"

export PATH=/$arch/bin:$PATH

# Clean everything up if we are rebuilding.
#
if [ $rebuild = y ]; then
  rm -rf libcutl
  rm -rf odb
  rm -rf $install_root
  rm -rf libodb
  rm -rf libodb-boost
  rm -rf libodb-qt

  if [ ! -d ../boost-binary ]; then
    error "no boost distribution in ../boost-binary"
    exit 1
  fi

  tar xfz libcutl-$cver.tar.gz
  mv libcutl-$cver libcutl

  tar xfz odb-$over.tar.gz
  mv odb-$over odb

  libodb=`echo libodb-$mver.*.tar.gz | sed -e 's%\(.*\)\.tar\.gz%\1%'`
  tar xfz $libodb.tar.gz
  mv $libodb libodb

  libodb_boost=`echo libodb-boost-$mver.*.tar.gz | sed -e 's%\(.*\)\.tar\.gz%\1%'`
  tar xfz $libodb_boost.tar.gz
  mv $libodb_boost libodb-boost

  libodb_qt=`echo libodb-qt-$mver.*.tar.gz | sed -e 's%\(.*\)\.tar\.gz%\1%'`
  tar xfz $libodb_qt.tar.gz
  mv $libodb_qt libodb-qt
fi

rm -f /tmp/odb-$over-$cpu-linux-gnu.tar.bz2

# Build libcutl
#
cd libcutl

if [ $rebuild = y ]; then
  ../libcutl-configure
fi

make
cd ..

# Build odb
#
cd odb

if [ $rebuild = y ]; then
  ../odb-configure $over $arch $install_root $libexecdir
fi

make
make install-strip
cd ..

# Build libodb
#
cd libodb

if [ $rebuild = y ]; then
  ../libodb-configure $install_root/$libexecdir/odb/$arch
fi

make
cd odb
make install-data
cd ../..

# Build libodb-boost
#
cd libodb-boost

if [ $rebuild = y ]; then
  ../libodb-boost-configure $install_root/$libexecdir/odb/$arch
fi

make
make install-data
cd ..

# Build libodb-qt
#
cd libodb-qt

if [ $rebuild = y ]; then
  ../libodb-qt-configure $install_root/$libexecdir/odb/$arch
fi

make
make install-data
cd ..

# Copy /$arch over to installation
#
cp -r /$arch $install_root/$libexecdir/odb/

# Copy the default options file.
#
mkdir -p $install_root/etc/odb
cp -L ./default.options $install_root/etc/odb/

f="$install_root/etc/odb/default.options"

echo ''                                                                  >>$f
echo '# Debian/Ubuntu new multiarch support places certain headers into' >>$f
echo '# /usr/include/<arch>. Add that path to the search list but use'   >>$f
echo '# -idirafter to make sure it is used as a last resort only.'       >>$f
echo '#'                                                                 >>$f
if [ "$arch" = "x86_64-linux-gnu" ]; then
  echo '-idirafter /usr/include/x86_64-linux-gnu' >> $f
else
  echo '-idirafter /usr/include/i386-linux-gnu' >> $f
fi

# Copy manifest and README.
#
cp -L manifest $install_root/$libexecdir/odb/$arch/
cp -L README $install_root/

# Move doc and man out of share/
#
rm -rf $install_root/doc $install_root/man
mv $install_root/share/man $install_root/
mv $install_root/share/doc/odb $install_root/doc
rm -r $install_root/share

# Clean some things up.
#
rm -f `find $install_root -name '*.la'`

# Remove features.h from include-fixed. This file causes trouble on newer
# distributions.
#
include_fixed=`find $install_root/$libexecdir/odb/$arch -type d -name include-fixed`
rm $include_fixed/features.h

# Pack it up.
#
cd /tmp
tar cfj $wd/test/odb-$over-$cpu-linux-gnu.tar.bz2 odb-$over-$cpu-linux-gnu
cd $wd