forked from neugates/neuron-build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cross-package.sh
executable file
·210 lines (180 loc) · 7.82 KB
/
cross-package.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
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
201
202
203
204
205
206
207
208
209
210
#!/bin/bash
set -e
home=/home/neuron
branch=main
vendor=?
arch=?
version=?
cnc=false
custom=default
build_type=Release
while getopts ":a:v:o:c:n:d:" OPT; do
case ${OPT} in
a)
arch=$OPTARG
;;
o)
vendor=$OPTARG
;;
v)
version=$OPTARG
;;
c)
custom=$OPTARG
;;
n)
cnc=$OPTARG
;;
d)
build_type=$OPTARG
;;
esac
done
case $build_type in
(Release)
neuron_dir=$home/$branch/Program/$vendor/neuron;
neuron_modules_dir=$home/$branch/Program/$vendor/neuron-modules;
package_dir=$home/$branch/Program/$vendor/package/neuron;;
(Debug)
neuron_dir=$home/$branch/Program_Debug/$vendor/neuron;
neuron_modules_dir=$home/$branch/Program_Debug/$vendor/neuron-modules;
package_dir=$home/$branch/Program_Debug/$vendor/package/neuron;;
esac
library=$home/$branch/libs/$vendor
script_dir="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
rm -rf $package_dir
mkdir -p $package_dir
mkdir -p $package_dir/config
mkdir -p $package_dir/plugins/schema
mkdir -p $package_dir/logs
mkdir -p $package_dir/persistence
mkdir -p $package_dir/certs
cp .gitkeep $package_dir/logs/
cp .gitkeep $package_dir/persistence/
cp .gitkeep $package_dir/certs/
cp $neuron_dir/LICENSE $package_dir/config
cp $neuron_modules_dir/config/protobuf-LICENSE $package_dir/config/
cp $neuron_modules_dir/config/protobuf-c-LICENSE $package_dir/config/
cp $library/lib/libzlog.so.1.2 $package_dir/
cp $neuron_dir/LICENSE $package_dir/
cp $neuron_dir/build/libneuron-base.so $package_dir/
cp $neuron_modules_dir/build/liblicense.so $package_dir/
cp $neuron_dir/build/neuron $package_dir/
cp $neuron_dir/build/config/neuron.key \
$neuron_dir/build/config/neuron.pem \
$neuron_dir/build/config/neuron.json \
$neuron_dir/build/config/zlog.conf \
$neuron_dir/build/config/dev.conf \
$neuron_dir/build/config/*.sql \
$package_dir/config/
cp $neuron_modules_dir/build/config/neuron-default.lic \
$package_dir/persistence/
cp $neuron_modules_dir/default_plugins.json \
$neuron_modules_dir/build/config/opcua_cert.der \
$neuron_modules_dir/build/config/opcua_key.der \
$package_dir/config/
cp $neuron_dir/build/plugins/libplugin-mqtt.so \
$neuron_dir/build/plugins/libplugin-ekuiper.so \
$neuron_dir/build/plugins/libplugin-aws-iot.so \
$neuron_dir/build/plugins/libplugin-azure-iot.so \
$package_dir/plugins/
cp $neuron_dir/build/plugins/schema/*.json \
$package_dir/plugins/schema/
cp $neuron_modules_dir/build/plugins/libplugin-websocket.so \
$neuron_modules_dir/build/plugins/libplugin-gewu.so \
$neuron_modules_dir/build/plugins/libplugin-sparkplugb.so \
$neuron_modules_dir/build/plugins/libplugin-opcua.so \
$neuron_modules_dir/build/plugins/libplugin-EtherNet-IP.so \
$neuron_modules_dir/build/plugins/libplugin-Profinet.so \
$neuron_modules_dir/build/plugins/libplugin-qna3e.so \
$neuron_modules_dir/build/plugins/libplugin-a1e.so \
$neuron_modules_dir/build/plugins/libplugin-fx.so \
$neuron_modules_dir/build/plugins/libplugin-s7comm.so \
$neuron_modules_dir/build/plugins/libplugin-s7comm-for-300.so \
$neuron_modules_dir/build/plugins/libplugin-s5fetch-write.so \
$neuron_modules_dir/build/plugins/libplugin-mpi.so \
$neuron_modules_dir/build/plugins/libplugin-fins-tcp.so \
$neuron_modules_dir/build/plugins/libplugin-fins-udp.so \
$neuron_modules_dir/build/plugins/libplugin-hostlink-cmode.so \
$neuron_modules_dir/build/plugins/libplugin-ads.so \
$neuron_modules_dir/build/plugins/libplugin-df1.so \
$neuron_modules_dir/build/plugins/libplugin-comli.so \
$neuron_modules_dir/build/plugins/libplugin-mewtocol.so \
$neuron_modules_dir/build/plugins/libplugin-iec104-standard.so \
$neuron_modules_dir/build/plugins/libplugin-iec102.so \
$neuron_modules_dir/build/plugins/libplugin-iec103.so \
$neuron_modules_dir/build/plugins/libplugin-iec101.so \
$neuron_modules_dir/build/plugins/libplugin-iec61850.so \
$neuron_modules_dir/build/plugins/libplugin-iec61850-browse.so \
$neuron_modules_dir/build/plugins/libplugin-dlt645-2007.so \
$neuron_modules_dir/build/plugins/libplugin-dlt645-1997.so \
$neuron_modules_dir/build/plugins/libplugin-bacnet.so \
$neuron_modules_dir/build/plugins/libplugin-knx.so \
$neuron_modules_dir/build/plugins/libplugin-HJ212.so \
$neuron_modules_dir/build/plugins/libplugin-nona11.so \
$neuron_modules_dir/build/plugins/libplugin-modbus-tcp.so \
$neuron_modules_dir/build/plugins/libplugin-modbus-rtu.so \
$neuron_modules_dir/build/plugins/libplugin-modbus-qh-tcp.so \
$neuron_modules_dir/build/plugins/libplugin-inovance-modbus-tcp.so \
$neuron_modules_dir/build/plugins/libplugin-modbus-ascii.so \
$neuron_modules_dir/build/plugins/libplugin-xinje-modbus-rtu.so \
$neuron_modules_dir/build/plugins/libplugin-hollysys-modbus-rtu.so \
$neuron_modules_dir/build/plugins/libplugin-hollysys-modbus-tcp.so \
$neuron_modules_dir/build/plugins/libplugin-hsms.so \
$neuron_modules_dir/build/plugins/libplugin-kuka.so \
$neuron_modules_dir/build/plugins/libplugin-license-server.so \
$neuron_modules_dir/build/plugins/libplugin-EtherNet-IP-1400.so \
$neuron_modules_dir/build/plugins/libplugin-EtherNet-IP-5500.so \
$neuron_modules_dir/build/plugins/libplugin-srtp.so \
$neuron_modules_dir/build/plugins/libplugin-mtconnect.so \
$neuron_modules_dir/build/plugins/libplugin-codesys3.so \
$neuron_modules_dir/build/plugins/libplugin-ab5000.so \
$neuron_modules_dir/build/plugins/libplugin-omron-cip.so \
$neuron_modules_dir/build/plugins/libplugin-dnp3.so \
$package_dir/plugins/
cp $neuron_modules_dir/build/plugins/schema/*.json \
$package_dir/plugins/schema/
case $cnc in
(true)
cp $neuron_modules_dir/build/plugins/libplugin-focas.so \
$neuron_modules_dir/build/plugins/libplugin-mitsubishi_cnc.so \
$neuron_modules_dir/build/plugins/libplugin-heidenhain_cnc.so \
$package_dir/plugins/;
python3 update_default_plugins.py $package_dir/config/default_plugins.json "libplugin-focas.so,libplugin-mitsubishi_cnc.so,libplugin-heidenhain_cnc.so";;
(false)
echo "no cnc";;
esac
cp $neuron_modules_dir/build/plugins/focas/libfocas32.so.1 $package_dir/
case $custom in
(cun)
cp $neuron_modules_dir/build/plugins/libplugin-gewu2.so \
$neuron_modules_dir/build/plugins/libplugin-s7comm-for-un.so \
$package_dir/plugins/;
python3 update_default_plugins.py $package_dir/config/default_plugins.json "libplugin-gewu2.so,libplugin-s7comm-for-un.so";;
(hr)
cp $neuron_modules_dir/build/plugins/libplugin-iec104.so \
$package_dir/plugins/;
python3 update_default_plugins.py $package_dir/config/default_plugins.json "libplugin-iec104.so";;
(default)
echo "no custom";;
esac
case $build_type in
(Debug)
if [ $vendor == "x86_64-neuron-linux-gnu" ]; then
cp /home/neuron/buildroot/$vendor/output/host/usr/$vendor/lib64/libasan.so.2.0.0 $package_dir/
cd $package_dir
ln -s ./libasan.so.2.0.0 libasan.so.2
fi;;
(Release)
echo "release";;
esac
cd $package_dir/..
rm -rf neuron*.tar.gz
case $build_type in
(Release)
tar czf neuron-$version-linux-$arch.tar.gz neuron;
echo "neuron-$version-linux-$arch.tar.gz";;
(Debug)
tar czf neuron-$version-debug-linux-$arch.tar.gz neuron;
echo "neuron-$version-debug-linux-$arch.tar.gz";;
esac