1 | #!/usr/bin/env bash
|
---|
2 |
|
---|
3 | echo "##########################################################"
|
---|
4 | echo "# ___________ ____ ______ __ __ _____ #"
|
---|
5 | echo "# \____ \__ \ _/ ___\\____ \^| ^| \/ ___/ #"
|
---|
6 | echo "# ^| ^|_^> ^> __ \\ \___^| ^|_^> ^> ^| /\___ \ #"
|
---|
7 | echo "# ^| __(____ /\___ ^> __/^|____//____ ^> #"
|
---|
8 | echo "# ^|__^| \/ \/^|__^| \/ #"
|
---|
9 | echo "# #"
|
---|
10 | echo "##########################################################"
|
---|
11 | echo ""
|
---|
12 | echo "========================================"
|
---|
13 | echo " PACPUS BUILD Linux "
|
---|
14 | echo "========================================"
|
---|
15 |
|
---|
16 |
|
---|
17 | function usage {
|
---|
18 | echo Usage:
|
---|
19 | echo build-linux.sh [install_dir]
|
---|
20 | echo [install-dir] is optional
|
---|
21 | echo The script must be run in the build directory, which is 'trunk\build'
|
---|
22 | echo ""
|
---|
23 | echo Where:
|
---|
24 | echo install_dir is the installation directory of the library
|
---|
25 | echo ""
|
---|
26 | echo For instance, here is how to build Pacpus:
|
---|
27 | echo ../scripts/build-linux.sh "/opt/Pacpus"
|
---|
28 | echo ""
|
---|
29 | exit 1
|
---|
30 | }
|
---|
31 |
|
---|
32 | function build {
|
---|
33 | # Initialize the build
|
---|
34 | cmake .. -DPACPUS_INSTALL_DIR=$1 -DPACPUS_INSTALL_3RD=TRUE \
|
---|
35 | -DPACPUS_USE_LOG=TRUE -DCMAKE_BUILD_TYPE=Release \
|
---|
36 | -DPACPUS_INSTALL_WITH_VERSION_NUMBER=TRUE
|
---|
37 | make -j4
|
---|
38 | sudo make install
|
---|
39 | cmake .. -DPACPUS_INSTALL_DIR=$1 -DPACPUS_INSTALL_3RD=TRUE \
|
---|
40 | -DPACPUS_USE_LOG=TRUE -DCMAKE_BUILD_TYPE=Debug
|
---|
41 | -DPACPUS_INSTALL_WITH_VERSION_NUMBER=TRUE \
|
---|
42 | make -j4
|
---|
43 | sudo make install
|
---|
44 | echo "Build finished"
|
---|
45 | exit 0
|
---|
46 | }
|
---|
47 |
|
---|
48 | #Check if the user is in the build directory
|
---|
49 | if [ `basename $PWD` == "build" ]; then
|
---|
50 | if [ $# -ne 1 ]; then
|
---|
51 | INST_PATH="/opt/pacpus"
|
---|
52 | else
|
---|
53 | INST_PATH=$1
|
---|
54 | fi
|
---|
55 | build $INST_PATH
|
---|
56 | else
|
---|
57 | usage
|
---|
58 | fi
|
---|