Clean up spec file
[platform/adaptation/broadcom/libomxil-vc4.git] / buildme
1 #!/bin/bash
2 BUILDTYPE=Release
3
4 if [ "$1" = "--debug" ]; then
5         BUILDTYPE=Debug
6         shift
7 fi
8
9 BUILDSUBDIR=`echo $BUILDTYPE | tr '[A-Z]' '[a-z]'`;
10
11 if [ "armv6l" = `arch` ] || [ "armv7l" = `arch` ]; then
12         # Native compile on the Raspberry Pi
13         mkdir -p build/raspberry/$BUILDSUBDIR
14         pushd build/raspberry/$BUILDSUBDIR
15         cmake -DCMAKE_BUILD_TYPE=$BUILDTYPE ../../..
16         if [ "armv6l" = `arch` ]; then
17                 make
18         else
19                 make -j4
20         fi
21         if [ "$1" != "" ]; then
22                 sudo make install DESTDIR=$1
23         else
24                 sudo make install
25         fi
26 elif [ "$1" = "--native" ]; then
27         # Build natively on the host
28         mkdir -p build/native/$BUILDSUBDIR
29         pushd build/native/$BUILDSUBDIR
30         cmake -DCMAKE_BUILD_TYPE=$BUILDTYPE ../../..
31         shift
32         make -j `nproc` $*
33 else
34         # Cross compile on a more capable machine
35         mkdir -p build/arm-linux/$BUILDSUBDIR
36         pushd build/arm-linux/$BUILDSUBDIR
37         cmake -DCMAKE_TOOLCHAIN_FILE=../../../makefiles/cmake/toolchains/arm-linux-gnueabihf.cmake -DCMAKE_BUILD_TYPE=$BUILDTYPE ../../..
38         make -j `nproc`
39
40         if [ "$1" != "" ]; then
41                 sudo make install DESTDIR=$1
42         fi
43 fi
44 popd