-
Notifications
You must be signed in to change notification settings - Fork 1
/
makeBullets.sh
executable file
·97 lines (83 loc) · 3.29 KB
/
makeBullets.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#! /bin/bash
# Script to fetch the Bullet Physics Engine sources, build same
# using the 'buildBulletSMake.sh' script, and then build BulletSim
# .so's using 'buildBulletSim.sh'.
# This captures the steps needed and will be replaced by better scripts
# and Github actions.
#
# This can build two versions of Bullet: one of current version and another
# of Bullet version 2.86 which is the version of Bullet that was
# used in the BulletSim binaries distributed with OpenSimulator
# from 2015 to 2022.
# This also applies the BulletSim patches to the Bullet sources.
# Set these values to 'yes' or 'no' to enable/disable fetching and building
FETCHBULLETSOURCES=${FETCHBULLETSOURCES:-no}
BUILDBULLET2=${BUILDBULLET2:-no} # usually don't need the old version
BUILDBULLET3=${BUILDBULLET3:-yes}
# Note that Bullet3 sources are build in "bullet3/" and the
# these are copied into "bullet2/" and checkouted to the version 2 sources.
BASE=$(pwd)
if [[ "$FETCHBULLETSOURCES" == "yes" ]] ; then
cd "$BASE"
rm -rf bullet3
echo "=== Fetching Bullet Physics Engine sources into bullet3/"
git clone https://github.com/bulletphysics/bullet3.git
if [[ "$BUILDBULLET2" == "yes" ]] ; then
cd "$BASE"
echo "=== Creating bullet2/ of Bullet version 2.86"
rm -rf bullet2
cp -r bullet3 bullet2
cd bullet2
git checkout tags/2.86 -b tag-2.86
fi
echo "=== Applying BulletSim patches to bullet3"
cd "$BASE"
cd bullet3
for file in ../000* ; do cat $file | patch -p1 ; done
if [[ "$BUILDBULLET2" == "yes" ]] ; then
echo "=== Applying BulletSim patches to bullet2"
cd "$BASE"
cd bullet2
for file in ../2.86-00* ; do cat $file | patch -p1 ; done
fi
fi
cd "$BASE"
echo "=== Setting environment variables"
export BuildDate=$(date +%Y%m%d)
export BulletSimVersion=$(cat VERSION)
export BulletSimGitVersion=$(git rev-parse HEAD)
export BulletSimGitVersionShort=$(git rev-parse --short HEAD)
cd bullet3
export BulletVersion=$(cat VERSION)
export BulletGitVersion=$(git rev-parse HEAD)
export BulletGitVersionShort=$(git rev-parse --short HEAD)
echo "=== Creating version information file"
cd "$BASE"
rm BulletSimVersionInfo
touch BulletSimVersionInfo
echo "BuildDate=$BuildDate" > BulletSimVersionInfo
echo "BulletSimVersion=$BulletSimVersion" >> BulletSimVersionInfo
echo "BulletSimGitVersion=$BulletSimGitVersion" >> BulletSimVersionInfo
echo "BulletSimGitVersionShort=$BulletSimGitVersionShort" >> BulletSimVersionInfo
echo "BulletVersion=$BulletVersion" >> BulletSimVersionInfo
echo "BulletGitVersion=$BulletGitVersion" >> BulletSimVersionInfo
echo "BulletGitVersionShort=$BulletGitVersionShort" >> BulletSimVersionInfo
cat BulletSimVersionInfo
echo "=== removing libBulletSim-*"
rm libBulletSim-*.so
if [[ "$BUILDBULLET2" == "yes" ]] ; then
echo "=== building bullet2"
cd "$BASE"
# Build the Bullet physics engine
BULLETDIR=bullet2 ./buildBulletCMake.sh
# Build the BulletSim glue/wrapper statically linked to Bullet
./buildBulletSim.sh
fi
if [[ "$BUILDBULLET3" == "yes" ]] ; then
echo "=== building bullet3"
cd "$BASE"
# Build the Bullet physics engine
BULLETDIR=bullet3 ./buildBulletCMake.sh
# Build the BulletSim glue/wrapper statically linked to Bullet
./buildBulletSim.sh
fi