[253] | 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 IGEP "
|
---|
| 14 | echo "========================================"
|
---|
| 15 |
|
---|
| 16 | #recupere cmake
|
---|
| 17 | if [ -f /opt/poky/latest/sysroots/x86_64-pokysdk-linux/usr/bin/cmake ]; then
|
---|
| 18 | CMAKE_NATIVE=/opt/poky/latest/sysroots/x86_64-pokysdk-linux/usr/bin/cmake
|
---|
| 19 | elif [ -f /opt/poky/latest/sysroots/i686-pokysdk-linux/usr/bin/cmake ]; then
|
---|
| 20 | CMAKE_NATIVE=/opt/poky/latest/sysroots/i686-pokysdk-linux/usr/bin/cmake
|
---|
| 21 | else
|
---|
| 22 | echo "la toolchain n'est pas installée, lire https://devel.hds.utc.fr/projects/igep/wiki/toolchain/install"
|
---|
| 23 | exit 1
|
---|
| 24 | fi
|
---|
| 25 |
|
---|
| 26 |
|
---|
| 27 | function usage {
|
---|
| 28 | echo Usage:
|
---|
| 29 | echo build-linux.sh [install_dir]
|
---|
| 30 | echo [install-dir] is optional
|
---|
| 31 | echo The script must be run in the build directory, which is 'trunk\build'
|
---|
| 32 | echo ""
|
---|
| 33 | echo Where:
|
---|
| 34 | echo install_dir is the installation directory of the library
|
---|
| 35 | echo ""
|
---|
| 36 | echo For instance, here is how to build Pacpus:
|
---|
| 37 | echo ../scripts/build-igep.sh "/opt/Pacpus"
|
---|
| 38 | echo ""
|
---|
| 39 | exit 1
|
---|
| 40 | }
|
---|
| 41 |
|
---|
| 42 | function build {
|
---|
| 43 | # Initialize the build
|
---|
| 44 | $CMAKE_NATIVE .. -DPACPUS_INSTALL_DIR=$1 -DPACPUS_INSTALL_3RD=TRUE \
|
---|
| 45 | -DPACPUS_USE_LOG=TRUE -DCMAKE_BUILD_TYPE=Release \
|
---|
| 46 | -DPACPUS_INSTALL_WITH_VERSION_NUMBER=TRUE -DCMAKE_TOOLCHAIN_FILE=/opt/poky/toolchain.cmake
|
---|
| 47 | make
|
---|
| 48 | sudo make install
|
---|
| 49 | $CMAKE_NATIVE .. -DPACPUS_INSTALL_DIR=$1 -DPACPUS_INSTALL_3RD=TRUE \
|
---|
| 50 | -DPACPUS_USE_LOG=TRUE -DCMAKE_BUILD_TYPE=Debug
|
---|
| 51 | -DPACPUS_INSTALL_WITH_VERSION_NUMBER=TRUE -DCMAKE_TOOLCHAIN_FILE=/opt/poky/toolchain.cmake \
|
---|
| 52 | make
|
---|
| 53 | sudo make install
|
---|
| 54 | echo "Build finished"
|
---|
| 55 | exit 0
|
---|
| 56 | }
|
---|
| 57 |
|
---|
| 58 | #Check if the user is in the build directory
|
---|
| 59 | if [ `basename $PWD` == "build" ]; then
|
---|
| 60 | if [ $# -ne 1 ]; then
|
---|
| 61 | INST_PATH="/opt/pacpus"
|
---|
| 62 | else
|
---|
| 63 | INST_PATH=$1
|
---|
| 64 | fi
|
---|
| 65 | build $INST_PATH
|
---|
| 66 | else
|
---|
| 67 | usage
|
---|
| 68 | fi
|
---|