This repository has been archived by the owner on Feb 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathbuild.sh
executable file
·148 lines (117 loc) · 2.42 KB
/
build.sh
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
#!/bin/bash
set -e
make_control()
{
local package=$1
local arch=$2
local version=$3
local depends=$4
cat <<EOF
Source: canopen2
Section: pluto
Essential: no
Priority: optional
Package: $package
Architecture: $arch
Version: $version
Maintainer: Pluto Team <PlutoTeamCallisto@marel.com>
Depends: $depends
Description: CANopen master version 2.
EOF
}
make_target_control()
{
local name=$1
local arch=$2
local version=$3
make_control $name $arch $version "libmloop, appbase"
}
make_host_control()
{
local version=$1
make_control canopen2-crossdevelopment i386 $version \
"libmloop-crossdevelopment, appbase-crossdevelopment"
}
build_package()
{
local arch=$1
local path=$2
local name=$3
local version=$4
mkdir -p $path/DEBIAN
if [ "$arch" == "host" ]; then
arch=i386
make_host_control $version >$path/DEBIAN/control
else
make_target_control $name $arch $version >$path/DEBIAN/control
fi
fakeroot dpkg-deb -b -Zgzip $path $name\_$version\_$arch\.deb
rm -rf $path/DEBIAN
}
build_target_release()
{
local arch=$1
local path=build-$arch-release
local rootfs=build-host$(marel_getrootprefix $arch)
marel_make.sh $arch -j8 RELEASE=yes
make install RELEASE=yes PREFIX=/usr DESTDIR=$path
make install RELEASE=yes PREFIX=/usr DESTDIR=$rootfs
make clean
}
build_target_debug()
{
local arch=$1
local path=build-$arch-debug
local rootfs=build-host$(marel_getrootprefix $arch)
marel_make.sh $arch -j8
make install PREFIX=/usr DESTDIR=$path
make install PREFIX=/usr DESTDIR=$rootfs
make clean
}
build_target()
{
local arch=$1
build_target_release $arch && build_target_debug $arch
}
build_host_release()
{
local path=build-host
make -j8 RELEASE=yes
make install RELEASE=yes PREFIX=/usr DESTDIR=$path
make clean
}
build_host_debug()
{
local path=build-host
make -j8
make install PREFIX=/usr DESTDIR=$path
make clean
}
build_host()
{
build_host_release && build_host_debug
}
build_all()
{
for arch in $(marel_supportedtargets --deb); do
build_target $arch
done
build_host
}
build_all_packages()
{
local name=$1
local version=$2
for arch in $(marel_supportedtargets --deb); do
build_package $arch build-$arch-release $name $version
build_package $arch build-$arch-debug $name-dbg $version
done
build_package host build-host $name-crossdevelopment $version
}
get_version()
{
echo $(git describe --tags --dirty)-pluto$(pluto_version)
}
make distclean
build_all
build_all_packages canopen2 $(get_version)