|
a/ohbuild.sh |
|
b/ohbuild.sh |
1 |
#!/bin/sh
|
1 |
#!/bin/sh
|
2 |
|
2 |
|
3 |
# Helper script for building the openhome libs prior to building
|
3 |
# Helper script for building the openhome libs prior to building
|
|
|
4 |
# sc2mpd and mpd2sc.
|
|
|
5 |
#
|
|
|
6 |
# Read about Openhome ohNet here: http://www.openhome.org/wiki/OhNet
|
|
|
7 |
#
|
|
|
8 |
# The source code we process is:
|
|
|
9 |
# Copyright 2011-14, Linn Products Ltd. All rights reserved.
|
|
|
10 |
# See the license files under the different subdirs. In a nutshell: BSD
|
|
|
11 |
#
|
4 |
# scmpdcli. This is far from foolproof or knowledgeable, but it seems
|
12 |
# This is far from foolproof or knowledgeable, but it seems to get me
|
5 |
# to get me usable (static) libs. We first clone the git repositories,
|
13 |
# usable (static) libs.
|
6 |
# checkout a known ok version (it's more or less random, based on the
|
14 |
# There are 3 modes of operation:
|
7 |
# 1st date I tried this, but some further versions don't build), then
|
15 |
# -c: clone, adjust, trim the source directories and produce a tar file
|
8 |
# build th edifferent dirs.
|
16 |
# -b: clone, adjust the source dirs and build
|
9 |
# You should create a top empty dir first, then "sh ohbuild.sh mytopdir"
|
17 |
# -t: extract tar file and build.
|
|
|
18 |
#
|
|
|
19 |
# When cloning, we checkout a known ok version (it's more or less
|
|
|
20 |
# random, based on the last date I tried this, sometimes more recent
|
|
|
21 |
# versions don't build versions don't build), then build the different
|
|
|
22 |
# dirs.
|
|
|
23 |
#
|
|
|
24 |
# When producing the tar file, we get rid of the .git directory and a
|
|
|
25 |
# bunch of other things to reduce the size
|
|
|
26 |
|
10 |
|
27 |
|
11 |
fatal()
|
28 |
fatal()
|
12 |
{
|
29 |
{
|
13 |
echo $*; exit 1
|
30 |
echo $*; exit 1
|
14 |
}
|
31 |
}
|
|
|
32 |
|
15 |
usage()
|
33 |
usage()
|
16 |
{
|
34 |
{
|
17 |
fatal "Usage: ohbuild.sh <topdir>"
|
35 |
echo "Usage:"
|
|
|
36 |
echo "ohbuild.sh -c <topdir> : clone and adjust openhome directories"
|
|
|
37 |
echo " from the git repositories, and produce tar file in /tmp"
|
|
|
38 |
echo "ohbuild.sh -t <tarfile> <topdir> : extract tar file in top dir and"
|
|
|
39 |
echo " build openhome in there"
|
|
|
40 |
echo "ohbuild.sh -b <topdir> : clone and build, no cleaning up of unused"
|
|
|
41 |
echo " files, no tar file"
|
|
|
42 |
echo "ohbuild.sh <topdir> : just build, don't change the tree"
|
|
|
43 |
exit 1
|
18 |
}
|
44 |
}
|
|
|
45 |
|
|
|
46 |
opt_t=0
|
|
|
47 |
opt_c=0
|
|
|
48 |
opt_b=0
|
|
|
49 |
tarfile=''
|
|
|
50 |
|
|
|
51 |
opts=`getopt -n ohbuild.sh -o t:cb -- "$@"`
|
|
|
52 |
eval set -- "$opts"
|
|
|
53 |
|
|
|
54 |
while true ; do
|
|
|
55 |
case "$1" in
|
|
|
56 |
-t) opt_t=1; tarfile=$2 ; shift 2 ;;
|
|
|
57 |
-b) opt_b=1; shift ;;
|
|
|
58 |
-c) opt_c=1; shift ;;
|
|
|
59 |
--) shift ; break ;;
|
|
|
60 |
*) echo "Internal error!" ; exit 1 ;;
|
|
|
61 |
esac
|
|
|
62 |
done
|
|
|
63 |
|
|
|
64 |
echo opt_t $opt_t
|
|
|
65 |
echo opt_c $opt_c
|
|
|
66 |
echo opt_b $opt_b
|
|
|
67 |
echo tarfile $tarfile
|
|
|
68 |
|
19 |
test $# = 1 || usage
|
69 |
test $# -eq 1 || usage
|
20 |
topdir=$1
|
70 |
topdir=$1
|
|
|
71 |
echo topdir $topdir
|
21 |
|
72 |
|
22 |
test -d $topdir || mkdir $topdir || fatal "Can't create $topdir"
|
73 |
# Only one of -tcb
|
23 |
|
74 |
tot=`expr $opt_t + $opt_c + $opt_b`
|
24 |
cd $topdir || exit 1
|
75 |
test $tot -le 1 || usage
|
25 |
topdir=`pwd`
|
|
|
26 |
|
|
|
27 |
|
|
|
28 |
otherfiles=`echo *.*`
|
|
|
29 |
test "$otherfiles" != '*.*' && fatal not in top dir
|
|
|
30 |
|
76 |
|
31 |
arch=
|
77 |
arch=
|
32 |
debug=
|
78 |
debug=
|
33 |
|
79 |
|
|
|
80 |
test -d $topdir || mkdir $topdir || fatal "Can't create $topdir"
|
|
|
81 |
|
|
|
82 |
cd $topdir || exit 1
|
|
|
83 |
# Make topdir an absolute path
|
|
|
84 |
topdir=`pwd`
|
|
|
85 |
|
|
|
86 |
otherfiles=`echo *.*`
|
|
|
87 |
test "$otherfiles" != '*.*' && fatal topdir should not contain files
|
|
|
88 |
|
34 |
clone_oh()
|
89 |
clone_oh()
|
35 |
{
|
90 |
{
|
|
|
91 |
echo "Cloning OpenHome from git repos into $topdir"
|
36 |
cd $topdir
|
92 |
cd $topdir
|
37 |
for rep in \
|
93 |
for rep in \
|
38 |
https://github.com/openhome/ohNet.git \
|
94 |
https://github.com/openhome/ohNet.git \
|
39 |
https://github.com/openhome/ohdevtools.git \
|
95 |
https://github.com/openhome/ohdevtools.git \
|
40 |
https://github.com/openhome/ohNetGenerated.git \
|
96 |
https://github.com/openhome/ohNetGenerated.git \
|
|
... |
|
... |
44 |
dir=`echo $rep | sed -e 's+https://github.com/openhome/++' \
|
100 |
dir=`echo $rep | sed -e 's+https://github.com/openhome/++' \
|
45 |
-e 's/\.git$//'`
|
101 |
-e 's/\.git$//'`
|
46 |
echo $dir
|
102 |
echo $dir
|
47 |
test ! -d $dir && git clone $rep
|
103 |
test ! -d $dir && git clone $rep
|
48 |
done
|
104 |
done
|
49 |
}
|
|
|
50 |
|
105 |
|
51 |
build_ohNet()
|
106 |
|
52 |
{
|
|
|
53 |
cd $topdir
|
107 |
cd $topdir/ohNet
|
54 |
dir=ohNet
|
|
|
55 |
echo building $dir
|
|
|
56 |
cd $dir
|
|
|
57 |
# Nov 30 2015. Commits from early december broke ohNetGenerated
|
108 |
# Nov 30 2015. Commits from early december broke ohNetGenerated
|
58 |
git checkout 0e22566e3da0eb9b40f4183e76254c6f2a3c2909 || exit 1
|
109 |
git checkout 0e22566e3da0eb9b40f4183e76254c6f2a3c2909 || exit 1
|
59 |
|
110 |
|
60 |
git checkout Makefile
|
111 |
git checkout Makefile
|
61 |
# Note: the 'make: o: Command not found' errors originate in
|
112 |
# Note: the 'make: o: Command not found' errors originate in
|
|
... |
|
... |
77 |
endif
|
128 |
endif
|
78 |
default : all
|
129 |
default : all
|
79 |
|
130 |
|
80 |
EOF
|
131 |
EOF
|
81 |
|
132 |
|
82 |
make native_only=yes || exit 1
|
|
|
83 |
|
|
|
84 |
cd ..
|
|
|
85 |
}
|
|
|
86 |
|
|
|
87 |
build_ohNetGenerated()
|
|
|
88 |
{
|
|
|
89 |
dir=ohNetGenerated
|
133 |
cd $topdir/ohNetGenerated
|
90 |
echo building $dir
|
|
|
91 |
cd $dir
|
|
|
92 |
# Jul 30 2015
|
134 |
# Jul 30 2015
|
93 |
git checkout 92294ce514dbe38fa569fce8b58588f40bf09cdb || exit 1
|
135 |
git checkout 92294ce514dbe38fa569fce8b58588f40bf09cdb || exit 1
|
94 |
git checkout Makefile
|
136 |
git checkout Makefile
|
95 |
patch -p1 <<EOF
|
137 |
patch -p1 <<EOF
|
96 |
diff --git a/Makefile b/Makefile
|
138 |
diff --git a/Makefile b/Makefile
|
|
... |
|
... |
105 |
endif
|
147 |
endif
|
106 |
default : all
|
148 |
default : all
|
107 |
|
149 |
|
108 |
EOF
|
150 |
EOF
|
109 |
|
151 |
|
|
|
152 |
cd $topdir/ohdevtools
|
|
|
153 |
# Dec 9 2015
|
|
|
154 |
git checkout 77f4f971e2c62e84a7eab2a1bcf4aa3dc3590840 || exit 1
|
|
|
155 |
|
|
|
156 |
cd $topdir/ohTopology
|
|
|
157 |
# Mar 17 2015
|
|
|
158 |
git checkout 18f004621a7b0dc3add6ddfeec781bd3878ae42e || exit 1
|
|
|
159 |
|
|
|
160 |
cd $topdir/ohSongcast
|
|
|
161 |
# Aug 19 2015
|
|
|
162 |
git checkout fe9b8a80080118f3bff9b44328975d10bc2c230b || exit 1
|
|
|
163 |
}
|
|
|
164 |
|
|
|
165 |
make_tarfile()
|
|
|
166 |
{
|
|
|
167 |
cd $topdir || exit 1
|
|
|
168 |
|
|
|
169 |
# Make space: get rid of the .git and other not useful data, then
|
|
|
170 |
# produce a tar file for reproduction
|
|
|
171 |
for dir in ohNet ohNetGenerated ohdevtools ohTopology ohSongcast;do
|
|
|
172 |
test -d $dir || fatal no "'$dir'" in "'$topdir'"
|
|
|
173 |
rm -rf $topdir/$dir/.git
|
|
|
174 |
done
|
|
|
175 |
rm -rf $topdir/ohNet/thirdparty
|
|
|
176 |
rm -rf $topdir/ohNetGenerated/OpenHome/Net/Bindings/Cs
|
|
|
177 |
rm -rf $topdir/ohNetGenerated/OpenHome/Net/Bindings/Java
|
|
|
178 |
rm -rf $topdir/ohNetGenerated/OpenHome/Net/Bindings/Js
|
|
|
179 |
rm -rf $topdir/ohNetGenerated/OpenHome/Net/T4/
|
|
|
180 |
rm -rf $topdir/ohSongcast/Docs/
|
|
|
181 |
rm -rf $topdir/ohSongcast/ohSongcast/Mac
|
|
|
182 |
rm -rf $topdir/ohSongcast/ohSongcast/Windows
|
|
|
183 |
rm -rf $topdir/ohTopology/waf
|
|
|
184 |
rm -rf $topdir/ohdevtools/nuget
|
|
|
185 |
|
|
|
186 |
dt=`date +%Y%m%d`
|
|
|
187 |
tar czf $tarfile/tmp/openhome-sc2-${dt}.tar.gz .
|
|
|
188 |
}
|
|
|
189 |
|
|
|
190 |
build_ohNet()
|
|
|
191 |
{
|
|
|
192 |
dir=ohNet
|
|
|
193 |
echo;echo building $dir
|
|
|
194 |
cd $topdir/$dir || exit 1
|
|
|
195 |
|
|
|
196 |
make native_only=yes || exit 1
|
|
|
197 |
|
|
|
198 |
cd ..
|
|
|
199 |
}
|
|
|
200 |
|
|
|
201 |
build_ohNetGenerated()
|
|
|
202 |
{
|
|
|
203 |
dir=ohNetGenerated
|
|
|
204 |
echo;echo building $dir
|
|
|
205 |
cd $topdir/$dir || exit 1
|
|
|
206 |
|
110 |
# e.g. Linux-x64, Linux-armhf
|
207 |
# e.g. Linux-x64, Linux-armhf
|
111 |
arch=`basename $topdir/ohNet/Build/Bundles/ohNet-*-*.tar.gz | \
|
208 |
arch=`basename $topdir/ohNet/Build/Bundles/ohNet-*-*.tar.gz | \
|
112 |
sed -e s/ohNet-// -e s/-[A-Z][a-z][a-z]*\.tar\.gz$//`
|
209 |
sed -e s/ohNet-// -e s/-[A-Z][a-z][a-z]*\.tar\.gz$//`
|
113 |
# e.g. Debug, Release
|
210 |
# e.g. Debug, Release
|
114 |
debug=`basename $topdir/ohNet/Build/Bundles/ohNet-*-*.tar.gz | \
|
211 |
debug=`basename $topdir/ohNet/Build/Bundles/ohNet-*-*.tar.gz | \
|
|
... |
|
... |
118 |
mkdir -p "$sd"
|
215 |
mkdir -p "$sd"
|
119 |
(cd $sd;
|
216 |
(cd $sd;
|
120 |
tar xvzf $topdir/ohNet/Build/Bundles/ohNet-${arch}-${debug}.tar.gz
|
217 |
tar xvzf $topdir/ohNet/Build/Bundles/ohNet-${arch}-${debug}.tar.gz
|
121 |
) || exit 1
|
218 |
) || exit 1
|
122 |
|
219 |
|
|
|
220 |
# Create bogus files for unused Makefile dependencies which we don't
|
|
|
221 |
# carry in the tar file.
|
|
|
222 |
mkdir -p OpenHome/Net/Service/ OpenHome/Net/T4/Templates/
|
|
|
223 |
touch OpenHome/Net/Service/Services.xml \
|
|
|
224 |
OpenHome/Net/T4/Templates/UpnpMakeT4.tt \
|
|
|
225 |
OpenHome/Net/T4/Templates/CpUpnpMakeProxies.tt \
|
|
|
226 |
OpenHome/Net/T4/Templates/DvUpnpMakeDevices.tt
|
123 |
|
227 |
|
124 |
make native_only=yes
|
228 |
make native_only=yes
|
125 |
|
229 |
|
126 |
# Copy the includes from here to the ohNet dir where ohTopology
|
230 |
# Copy the includes from here to the ohNet dir where ohTopology
|
127 |
# will want them
|
231 |
# will want them
|
128 |
tar cf - Build/Include | (cd $topdir/ohNet/;tar xvf -) || exit 1
|
232 |
tar cf - Build/Include | (cd $topdir/ohNet/;tar xvf -) || exit 1
|
129 |
|
|
|
130 |
cd ..
|
|
|
131 |
}
|
233 |
}
|
132 |
|
234 |
|
133 |
build_ohdevtools()
|
235 |
build_ohdevtools()
|
134 |
{
|
236 |
{
|
135 |
cd $topdir
|
|
|
136 |
dir=ohdevtools
|
237 |
dir=ohdevtools
|
137 |
echo building $dir
|
238 |
echo;echo building $dir
|
138 |
cd $dir
|
239 |
cd $topdir/$dir || exit 1
|
139 |
|
240 |
|
140 |
# Dec 9 2015
|
|
|
141 |
git checkout 77f4f971e2c62e84a7eab2a1bcf4aa3dc3590840 || exit 1
|
|
|
142 |
# Nothing to build
|
241 |
# Nothing to build
|
143 |
cd ..
|
|
|
144 |
}
|
242 |
}
|
145 |
|
243 |
|
146 |
|
244 |
|
147 |
# It appears that nothing compiled in topology is needed for Receivers
|
245 |
# It appears that nothing compiled in topology is needed for Receivers
|
148 |
# or Senders, only managers of those. Some of the include files are
|
246 |
# or Senders, only managers of those. Some of the include files are
|
149 |
# needed (or at least used) though.
|
247 |
# needed (or at least used) though.
|
150 |
build_ohTopology()
|
248 |
build_ohTopology()
|
151 |
{
|
249 |
{
|
152 |
cd $topdir
|
|
|
153 |
dir=ohTopology
|
250 |
dir=ohTopology
|
154 |
echo building $dir
|
251 |
echo;echo building $dir
|
155 |
cd $dir
|
252 |
cd $topdir/$dir || exit 1
|
156 |
|
253 |
|
157 |
# Mar 17 2015
|
|
|
158 |
git checkout 18f004621a7b0dc3add6ddfeec781bd3878ae42e || exit 1
|
|
|
159 |
|
|
|
160 |
#./go fetch --all --clean
|
254 |
#./go fetch --all --clean
|
161 |
#./waf configure --ohnet=../ohNet --dest-platform=Linux-x86
|
255 |
#./waf configure --ohnet=../ohNet --dest-platform=Linux-x86
|
162 |
|
256 |
|
163 |
# The build fails because of mono issues (trying to generate
|
257 |
# The build fails because of mono issues (trying to generate
|
164 |
# include files from templates, this is probably fixable as the e
|
258 |
# include files from templates, this is probably fixable as the e
|
165 |
# actual includes may exist somewhere).
|
259 |
# actual includes may exist somewhere).
|
166 |
#./waf build
|
260 |
#./waf build
|
167 |
|
261 |
|
168 |
mkdir -p build/Include/OpenHome/Av
|
262 |
mkdir -p build/Include/OpenHome/Av
|
169 |
cp -p OpenHome/Av/*.h build/Include/OpenHome/Av/
|
263 |
cp -p OpenHome/Av/*.h build/Include/OpenHome/Av/
|
170 |
|
|
|
171 |
cd ..
|
|
|
172 |
}
|
264 |
}
|
173 |
|
265 |
|
174 |
build_ohSongcast()
|
266 |
build_ohSongcast()
|
175 |
{
|
267 |
{
|
176 |
cd $topdir
|
|
|
177 |
dir=ohSongcast
|
268 |
dir=ohSongcast
|
178 |
echo building $dir
|
269 |
echo;echo building $dir
|
179 |
cd $dir
|
270 |
cd $topdir/$dir || exit 1
|
180 |
|
|
|
181 |
# Aug 19 2015
|
|
|
182 |
git checkout fe9b8a80080118f3bff9b44328975d10bc2c230b || exit 1
|
|
|
183 |
|
271 |
|
184 |
make release=1 Receiver WavSender
|
272 |
make release=1 Receiver WavSender
|
185 |
}
|
273 |
}
|
186 |
|
274 |
|
187 |
official_way()
|
275 |
official_way()
|
|
... |
|
... |
203 |
./waf build
|
291 |
./waf build
|
204 |
cd ../ohSongcast
|
292 |
cd ../ohSongcast
|
205 |
make release=1
|
293 |
make release=1
|
206 |
}
|
294 |
}
|
207 |
|
295 |
|
208 |
clone_oh
|
296 |
buildall()
|
209 |
|
297 |
{
|
|
|
298 |
echo "Building all in $topdir"
|
210 |
build_ohNet
|
299 |
build_ohNet
|
211 |
build_ohNetGenerated
|
300 |
build_ohNetGenerated
|
212 |
build_ohdevtools
|
301 |
build_ohdevtools
|
213 |
build_ohTopology
|
302 |
build_ohTopology
|
214 |
build_ohSongcast
|
303 |
build_ohSongcast
|
|
|
304 |
}
|
|
|
305 |
|
|
|
306 |
if test $opt_c -ne 0; then
|
|
|
307 |
test -d $topdir/ohNet && fatal target dir should be initially empty \
|
|
|
308 |
for producing a tar distribution
|
|
|
309 |
clone_oh || fatal clone failed
|
|
|
310 |
make_tarfile || fatal make_tarfile failed
|
|
|
311 |
exit 0
|
|
|
312 |
fi
|
|
|
313 |
|
|
|
314 |
# Extract tar, or clone git repos
|
|
|
315 |
if test $opt_t -eq 1; then
|
|
|
316 |
echo "Extracting tarfile in $topdir"
|
|
|
317 |
cd $topdir || exit 1
|
|
|
318 |
tar xf $tarfile
|
|
|
319 |
elif test $opt_b -eq 1; then
|
|
|
320 |
clone_oh
|
|
|
321 |
fi
|
|
|
322 |
|
|
|
323 |
buildall
|