|
| 1 | +#!/usr/bin/bash |
| 2 | + |
| 3 | +if [ "$3" == "" ]; then |
| 4 | + echo "Usage: $0 <platform> <version> <godot version>" |
| 5 | + echo "Platforms: linux|windows|all" |
| 6 | + echo "e.g. $0 linux 0.8.1-alpha 4.1.1" |
| 7 | + exit 1 |
| 8 | +fi |
| 9 | + |
| 10 | +NAME=terrain3d |
| 11 | +PLATFORM=$1 |
| 12 | +VERSION=$2 |
| 13 | +GDVER=$3 |
| 14 | +ZIPFILE="${NAME}_${VERSION}_gd${GDVER}" |
| 15 | +BIN="addons/terrain_3d/bin" |
| 16 | +STRIP=`which strip 2>/dev/null` |
| 17 | +INCLUDE="addons/terrain_3d demo project.godot" |
| 18 | +ADD="README.md LICENSE CONTRIBUTORS.md" |
| 19 | +EXCLUDE="$BIN/*.lib $BIN/*.exp" |
| 20 | +WIN_DBG_FILE="$BIN/libterrain.windows.debug.x86_64.dll" |
| 21 | +WIN_REL_FILE="$BIN/libterrain.windows.release.x86_64.dll" |
| 22 | +LIN_DBG_FILE="$BIN/libterrain.linux.debug.x86_64.so" |
| 23 | +LIN_REL_FILE="$BIN/libterrain.linux.release.x86_64.so" |
| 24 | + |
| 25 | +if [ ! -e .git ]; then |
| 26 | + echo .git dir not found. May not be in git root. |
| 27 | + exit 1 |
| 28 | +fi |
| 29 | +if [ ! -e "project/$BIN" ]; then |
| 30 | + echo Bin dir not found. May not be in git root. |
| 31 | + exit 1 |
| 32 | +fi |
| 33 | + |
| 34 | + |
| 35 | +# Build Windows |
| 36 | +if [ "$PLATFORM" == "windows" ] || [ "$PLATFORM" == "all" ]; then |
| 37 | + #if [ ! -e $WIN_DBG_FILE ] || [ ! -e $WIN_REL_FILE ]; then |
| 38 | + scons platform=windows && scons platform=windows target=template_release debug_symbols=false |
| 39 | + if [ $? -gt 0 ]; then |
| 40 | + echo Problem building. Exiting packaging script. |
| 41 | + exit $? |
| 42 | + fi |
| 43 | + if [ "$STRIP" != "" ]; then |
| 44 | + strip project/$WIN_REL_FILE |
| 45 | + fi |
| 46 | + #fi |
| 47 | + pushd project > /dev/null |
| 48 | + zip -r ../${ZIPFILE}_win64.zip $INCLUDE -x $EXCLUDE $LIN_DBG_FILE $LIN_REL_FILE |
| 49 | + popd > /dev/null |
| 50 | + zip -u ${ZIPFILE}_win64.zip $ADD |
| 51 | +fi |
| 52 | + |
| 53 | +# Build Linux |
| 54 | +if [ "$PLATFORM" == "linux" ] || [ "$PLATFORM" == "all" ]; then |
| 55 | + #if [ ! -e $LIN_DBG_FILE ] || [ ! -e $LIN_REL_FILE ]; then |
| 56 | + scons platform=linux && scons platform=linux target=template_release debug_symbols=false |
| 57 | + if [ $? -gt 0 ]; then |
| 58 | + echo Problem building. Exiting packaging script. |
| 59 | + exit $? |
| 60 | + fi |
| 61 | + if [ "$STRIP" != "" ]; then |
| 62 | + strip project/$LIN_REL_FILE |
| 63 | + fi |
| 64 | + #fi |
| 65 | + pushd project > /dev/null |
| 66 | + zip -r ../${ZIPFILE}_linux.x86-64.zip $INCLUDE -x $EXCLUDE $WIN_DBG_FILE $WIN_REL_FILE |
| 67 | + popd > /dev/null |
| 68 | + zip -u ${ZIPFILE}_linux.x86-64.zip $ADD |
| 69 | +fi |
| 70 | + |
0 commit comments