a b/ohbuild.sh
1
#!/bin/sh
2
3
# Helper script for building the openhome libs prior to building
4
# scmpdcli.  This is far from foolproof or knowledgeable, but it seems
5
# to get me usable (static) libs. We first clone the git repositories,
6
# checkout a known ok version (it's more or less random, based on the
7
# 1st date I tried this, but some further versions don't build), then
8
# build th edifferent dirs.
9
# You should create a top empty dir first, then "sh ohbuild.sh mytopdir"
10
11
fatal()
12
{
13
    echo $*; exit 1
14
}
15
usage()
16
{
17
    fatal "Usage: ohbuild.sh <topdir>"
18
}
19
test $# = 1 || usage
20
topdir=$1
21
22
cd $topdir || exit 1
23
topdir=`pwd`
24
25
26
otherfiles=`echo *.*`
27
test "$otherfiles"  != '*.*' && fatal not in top dir
28
29
arch=
30
debug=
31
32
clone_oh()
33
{
34
    cd $topdir
35
    for rep in \
36
        https://github.com/openhome/ohNet.git \
37
        https://github.com/openhome/ohdevtools.git \
38
        https://github.com/openhome/ohNetGenerated.git \
39
        https://github.com/openhome/ohTopology.git \
40
        https://github.com/openhome/ohSongcast.git \
41
        ; do
42
        dir=`echo $rep | sed -e 's+https://github.com/openhome/++' \
43
            -e 's/\.git$//'`
44
        echo $dir
45
        test ! -d $dir && git clone $rep
46
    done
47
}
48
49
build_ohNet()
50
{
51
    cd $topdir
52
    dir=ohNet
53
    echo building $dir
54
    cd  $dir
55
    git checkout b2207ce19d638b55f660896d5b42c49900e8e2cd
56
    make ohNetCore proxies devices TestFramework bundle || exit 1
57
58
    cd ..
59
}
60
61
build_ohNetGenerated()
62
{
63
    dir=ohNetGenerated
64
    echo building $dir
65
    cd  $dir
66
    git checkout b436c4f098cd3417c2b1e97f9a94b5875e71f200
67
    # e.g. Linux-x64, Linux-armhf
68
    arch=`basename $topdir/ohNet/Build/Bundles/ohNet-*-*.tar.gz | \
69
        sed -e s/ohNet-//  -e s/-[A-Z][a-z][a-z]*\.tar\.gz$//`
70
    # e.g. Debug, Release
71
    debug=`basename $topdir/ohNet/Build/Bundles/ohNet-*-*.tar.gz | \
72
        sed -e s/.*-//  -e s/\.tar\.gz$//`
73
74
    sd=dependencies/${arch}
75
    mkdir -p "$sd"
76
    (cd $sd;
77
        tar xvzf $topdir/ohNet/Build/Bundles/ohNet-${arch}-${debug}.tar.gz
78
    ) || exit 1
79
80
    # This should fail looking for some dll (csharp again), but that's ok
81
    make
82
83
    # Copy the includes from here to the ohNet dir where ohTopology
84
    # will want them
85
    tar cf - Build/Include | (cd $topdir/ohNet/;tar xvf -) || exit 1
86
87
    cd ..
88
}
89
90
build_ohdevtools()
91
{
92
    cd $topdir
93
    dir=ohdevtools
94
    echo building $dir
95
    cd  $dir
96
    git checkout 33d8e940a7737df1b2a500efc28ef1429df8f304
97
    # Nothing to build
98
    cd ..
99
}
100
101
build_ohTopology()
102
{
103
    cd $topdir
104
    dir=ohTopology
105
    echo building $dir
106
    cd  $dir
107
    git checkout 11767b53dda79564548b522a72db895f24e27437
108
109
    ./go fetch --all --clean 
110
111
    ./waf configure --ohnet=../ohNet --dest-platform=Linux-x86
112
    # This fails, but it creates what we need.
113
    ./waf build
114
115
    cd ..
116
}
117
118
build_ohSongcast()
119
{
120
    cd $topdir
121
    dir=ohSongcast
122
    echo building $dir
123
    cd  $dir
124
    git checkout 315fe6a191f512b2faf2502eb07613c4a3335bd3
125
126
    # This fails because the link options are wrong (-lpthread should be
127
    # at the end of the link line), but it builds the objs we need.
128
    make release=1 Receiver
129
}
130
131
official_way()
132
{
133
# from README, actually Does not work, for reference
134
    cd ohNet
135
    make ohNetCore proxies devices TestFramework
136
    cd ../ohNetGenerated
137
    make
138
    cd ../ohNetmon
139
    make
140
    cd ../ohTopology
141
    ./waf configure --ohnet=../ohNet --debug --dest-platform=[Windows-x86|Mac-x86|Linux-x86]
142
    ./waf build
143
    cd ../ohSongcast
144
    make release=1
145
}
146
147
#clone_oh
148
149
build_ohNet
150
build_ohNetGenerated
151
build_ohdevtools
152
build_ohTopology
153
build_ohSongcast