-
Notifications
You must be signed in to change notification settings - Fork 1
/
build-portable-linux.sh
executable file
·68 lines (54 loc) · 1.67 KB
/
build-portable-linux.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
#!/bin/bash
#
# Copyright (C) 2022 https://github.com/nkh-lab
#
# This is free software. You can redistribute it and/or
# modify it under the terms of the GNU General Public License
# version 3 as published by the Free Software Foundation.
#
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY.
#
DIR=$(cd "$(dirname "$0")" && pwd)
PROJECT_ROOT=$(cd $DIR/.. && pwd)
PORTABLE_DIR_REL_PATH="build/portable"
PORTABLE_ARCHIVE_NAME="usbrelaymodule-portable"
CMAKE_ARGS="-Dusbrelaymodule_BUILD_PORTABLE=ON"
for arg in "$@"
do
if [ "simu" = "$arg" ]; then
SIMU="true"
CMAKE_ARGS="$CMAKE_ARGS \
-Dusbrelaymodule_BUILD_SIMU=ON"
fi
if [ "gui" = "$arg" ]; then
GUI="true"
CMAKE_ARGS="$CMAKE_ARGS \
-Dusbrelaymodule_BUILD_GUI=ON"
fi
done
git submodule update --init
rm -rf build/
mkdir build && cd build
cmake $CMAKE_ARGS ..
make
# Check if build return error
if [ $? -ne 0 ]; then
exit $?
fi
cd $PROJECT_ROOT
mkdir $PORTABLE_DIR_REL_PATH
cp build/app-cli/getrelay $PORTABLE_DIR_REL_PATH
cp build/app-cli/setrelay $PORTABLE_DIR_REL_PATH
cp build/libusbrelaymodule/libusbrelaymodule.so $PORTABLE_DIR_REL_PATH
cp build/external/hidapi/src/linux/libhidapi-hidraw.so* $PORTABLE_DIR_REL_PATH
if [ "$SIMU" = "true" ]; then
cp build/external/jsoncpp/src/lib_json/libjsoncpp.so* $PORTABLE_DIR_REL_PATH
fi
if [ "$GUI" = "true" ]; then
cp build/app-gui/relaybox $PORTABLE_DIR_REL_PATH
cp build/external/jsoncpp/src/lib_json/libjsoncpp.so* $PORTABLE_DIR_REL_PATH
fi
cd $PORTABLE_DIR_REL_PATH
#zip -r ../$PORTABLE_ARCHIVE_NAME.zip *
tar -czf ../$PORTABLE_ARCHIVE_NAME.tar.gz *