]> git.sesse.net Git - casparcg/blob - build-scripts/build-linux.sh
* Initial build scripts for Linux.
[casparcg] / build-scripts / build-linux.sh
1 #!/bin/sh
2
3 fail()
4 {
5     echo "$1" 1>&2
6     exit 1
7 }
8
9 # Fail early if environment not set
10 [ -z "$BUILD_ARCHIVE_NAME" ] && fail "BUILD_ARCHIVE_NAME has to be set"
11 [ -z "$BUILD_PARALLEL_THREADS" ] && fail "BUILD_PARALLEL_THREADS has to be set"
12
13 # Clean and enter shadow build folder
14 echo Cleaning...
15 if [ -e ../build ]; then
16     rm -Rf ../build || fail "Could not delete ../build"
17 fi
18
19 mkdir ../build || fail "Could not create ../build"
20 cd ../build || fail "Could not enter ../build"
21
22 # Run qmake
23 echo Running cmake...
24 cmake -G "Unix Makefiles" -A x64 -DCMAKE_BUILD_TYPE=RelWithDebInfo .. || fail "cmake failed"
25
26 # Run make using the number of hardware threads in BUILD_PARALLEL_THREADS
27 echo Building...
28 /usr/bin/time -f 'Build time %E' make -j$BUILD_PARALLEL_THREADS || fail "make failed"
29
30 # Create client folder to later zip
31 export SERVER_FOLDER="$BUILD_ARCHIVE_NAME"
32 if [ -f "$SERVER_FOLDER" ]; then
33     rm -Rf "$SERVER_FOLDER" || fail "Could not delete $SERVER_FOLDER"
34 fi
35 mkdir "$SERVER_FOLDER" || fail "Could not create $SERVER_FOLDER"
36 mkdir "$SERVER_FOLDER/bin" || fail "Could not create $SERVER_FOLDER/bin"
37 mkdir "$SERVER_FOLDER/lib" || fail "Could not create $SERVER_FOLDER/lib"
38
39 # Copy compiled binaries
40 echo Copying binaries...
41 cp -fP shell/lib* "$SERVER_FOLDER/lib/" || fail "Could not copy server libraries"
42 cp -f shell/casparcg "$SERVER_FOLDER/bin/" || fail "Could not copy server executable"
43 cp -f shell/casparcg.config "$SERVER_FOLDER/" || fail "Could not copy server config"
44 cp -Rf shell/locales "$SERVER_FOLDER/bin/" || fail "Could not copy server CEF locales"
45
46 # Copy binary dependencies
47 echo Copying binary dependencies...
48 cp -RfP ../deploy/linux/* "$SERVER_FOLDER/" || fail "Could not copy binary dependencies"
49 #cp -RfP ../deploy/examples/* "$SERVER_FOLDER/" || fail "Could not copy binary dependencies"
50
51 # Copy documentation
52 echo Copying documentation...
53 cp -f ../CHANGES.txt "$SERVER_FOLDER/" || fail "Could not copy CHANGES.txt"
54 cp -f ../README.txt "$SERVER_FOLDER/" || fail "Could not copy README.txt"
55 cp -f ../LICENSE.txt "$SERVER_FOLDER/" || fail "Could not copy LICENSE.txt"
56
57 # Create tar.gz file
58 echo Creating tag.gz...
59 tar -cvzf "$BUILD_ARCHIVE_NAME.tar.gz" "$SERVER_FOLDER" || fail "Could not create archive"
60