]> git.sesse.net Git - casparcg/blob - build-scripts/build-linux.sh
Include CEF .pak files in builds
[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 # Unpack archived dependencies
14 cd ../dependencies64 || fail "Could not enter ../dependencies64"
15 tar xvJf large_files_linux.tar.xz || fail "Could not unpack large_files_linux.tar.xz"
16
17 # Clean and enter shadow build folder
18 echo Cleaning...
19 if [ -e ../build ]; then
20     rm -Rf ../build || fail "Could not delete ../build"
21 fi
22
23 mkdir ../build || fail "Could not create ../build"
24 cd ../build || fail "Could not enter ../build"
25
26 # Run cmake
27 echo Running cmake...
28 cmake -G "Unix Makefiles" -A x64 -DCMAKE_BUILD_TYPE=RelWithDebInfo .. || fail "cmake failed"
29
30 # Run make using the number of hardware threads in BUILD_PARALLEL_THREADS
31 echo Building...
32 /usr/bin/time -f 'Build time %E' make -j$BUILD_PARALLEL_THREADS || fail "make failed"
33
34 # Create client folder to later zip
35 export SERVER_FOLDER="$BUILD_ARCHIVE_NAME"
36 if [ -f "$SERVER_FOLDER" ]; then
37     rm -Rf "$SERVER_FOLDER" || fail "Could not delete $SERVER_FOLDER"
38 fi
39 mkdir "$SERVER_FOLDER" || fail "Could not create $SERVER_FOLDER"
40 mkdir "$SERVER_FOLDER/bin" || fail "Could not create $SERVER_FOLDER/bin"
41 mkdir "$SERVER_FOLDER/lib" || fail "Could not create $SERVER_FOLDER/lib"
42
43 # Copy compiled binaries
44 echo Copying binaries...
45 cp -f  shell/lib* "$SERVER_FOLDER/lib/" || fail "Could not copy server libraries"
46 cp -f  shell/*.ttf "$SERVER_FOLDER/" || fail "Could not copy font(s)"
47 cp -f  shell/*.pak "$SERVER_FOLDER/" || fail "Could not copy font(s)"
48 cp -f  shell/casparcg "$SERVER_FOLDER/bin/" || fail "Could not copy server executable"
49 cp -f  shell/casparcg.config "$SERVER_FOLDER/" || fail "Could not copy server config"
50 cp -Rf shell/locales "$SERVER_FOLDER/bin/" || fail "Could not copy server CEF locales"
51
52 # Copy binary dependencies
53 echo Copying binary dependencies...
54 cp -Rf ../deploy/linux/* "$SERVER_FOLDER/" || fail "Could not copy binary dependencies"
55 cp -f  ../deploy/general/*.pdf "$SERVER_FOLDER/" || fail "Could not copy pdf"
56 cp -Rf ../deploy/general/wallpapers "$SERVER_FOLDER/" || fail "Could not copy wallpapers"
57 cp -Rf ../deploy/general/server/media "$SERVER_FOLDER/" || fail "Could not copy media"
58
59 # Copy documentation
60 echo Copying documentation...
61 cp -f ../CHANGELOG "$SERVER_FOLDER/" || fail "Could not copy CHANGELOG"
62 cp -f ../README "$SERVER_FOLDER/" || fail "Could not copy README"
63 cp -f ../LICENSE "$SERVER_FOLDER/" || fail "Could not copy LICENSE"
64
65 # Create tar.gz file
66 echo Creating tag.gz...
67 tar -cvzf "$BUILD_ARCHIVE_NAME.tar.gz" "$SERVER_FOLDER" || fail "Could not create archive"
68