-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathros_melodic_install_osx.sh
163 lines (150 loc) · 4.73 KB
/
ros_melodic_install_osx.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#!/bin/bash
install_melodic(){
project_path=$(cd `dirname $0`; pwd)
set -e
# Homebrew
if ! hash brew 2>/dev/null; then
echo "Installing brew"
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
echo "brew tap homebrew/cask"
brew tap homebrew/cask
echo "brew tap osrf/simulation"
brew tap osrf/simulation
echo "brew tap ros/deps"
if [ ! -d $(brew --repo)/Library/Taps/ros/homebrew-deps ]; then
mkdir -p $(brew --repo)/Library/Taps/ros
cd $(brew --repo)/Library/Taps/ros
git clone https://github.com/nagakiran/homebrew-deps.git
fi
brew tap ros/deps
# brew update
brew --prefix python@2 2>/dev/null
if [ $? -ne 0 ]; then
brew install python@2
fi
mkdir -p ~/Library/Python/2.7/lib/python/site-packages
if [ ! -f ~/Library/Python/2.7/lib/python/site-packages/homebrew.pth ]; then
echo "$(brew --prefix)/lib/python2.7/site-packages" >>~/Library/Python/2.7/lib/python/site-packages/homebrew.pth
fi
brew --prefix python 2>/dev/null
if [ $? -ne 0 ]; then
brew install python
fi
mkdir -p ~/Library/Python/3.7/lib/python/site-packages
if [ ! -f ~/Library/Python/3.7/lib/python/site-packages/homebrew.pth ]; then
echo "$(brew --prefix)/lib/python3.7/site-packages" >>~/Library/Python/3.7/lib/python/site-packages/homebrew.pth
fi
brew cask install xquartz
brew --prefix gpgme 2>/dev/null
if [ $? -ne 0 ]; then
brew install gpgme
fi
# brew install gpgme
brew --prefix poco 2>/dev/null
if [ $? -ne 0 ]; then
brew install poco
fi
# brew install poco
brew --prefix gtest 2>/dev/null
if [ $? -ne 0 ]; then
brew install gtest
fi
# brew install gtest
brew --prefix lz4 2>/dev/null
if [ $? -ne 0 ]; then
brew install lz4
fi
# brew install lz4
brew --prefix fltk 2>/dev/null
if [ $? -ne 0 ]; then
brew install fltk
fi
# brew install fltk
brew --prefix boost-python3 2>/dev/null
if [ $? -ne 0 ]; then
brew install boost-python3
fi
# brew install boost-python3
brew --prefix yaml-cpp 2>/dev/null
if [ $? -ne 0 ]; then
brew install yaml-cpp
fi
# brew install yaml-cpp
brew --prefix opencv 2>/dev/null
if [ $? -ne 0 ]; then
brew install opencv
fi
# brew install opencv
brew --prefix pcl 2>/dev/null
if [ $? -ne 0 ]; then
brew install pcl
fi
# brew install pcl
brew --prefix log4cxx 2>/dev/null
if [ $? -ne 0 ]; then
brew install log4cxx
fi
# brew install log4cxx
# sudo -H python2 -m pip install -U pip
sudo -H python3 -m pip install -U pip
# sudo -H python2 -m pip install -U wstool rosdep rosinstall rosinstall_generator rospkg catkin-pkg
sudo -H python3 -m pip install -U wstool rosdep rosinstall rosinstall_generator rospkg catkin-pkg sphinx gnupg pydot
cd $project_path
echo $(pwd)
export ROS_PYTHON_VERSION=3
if [ ! -d /etc/ros/rosdep/ ]; then
sudo rosdep init
fi
if [ ! -f /etc/ros/rosdep/sources.list.d/10-ros-install-osx.list ]; then
echo "This sudo prompt adds the the brewed python rosdep yaml to /etc/ros/rosdep/sources.list.d/10-ros-install-osx.list"
sudo sh -c "echo 'yaml file://$(pwd)/rosdeps.yaml osx' > /etc/ros/rosdep/sources.list.d/10-ros-install-osx.list"
fi
if [ ! -f ~/.ros/rosdep/sources.cache/index ]; then
rosdep update
fi
if [ ! -f $(pwd)/melodic-desktop-full-wet.rosinstall ]; then
rosinstall_generator desktop_full --rosdistro melodic --deps --wet-only --tar >melodic-desktop-full-wet.rosinstall
fi
if [ ! -f $(pwd)/src/.rosinstall ]; then
wstool init -j8 src melodic-desktop-full-wet.rosinstall
else
wstool update -j 8 -t src
fi
rosdep install --from-paths src --ignore-src --rosdistro melodic -y
# patch
get_filelist() {
flist=()
index=1
for file in $(ls $1); do
if [ -d $1$file ]; then
get_filelist $1$file"//"
else
echo $1$file
fi
done
}
cd patch/
result=($(get_filelist ./))
cd ../
for f in $result[*]; do
echo "patch/"$f"to""src/"$f
cp $(pwd)"/patch/"$f $(pwd)"/src"$f
done
export PATH=$(brew --prefix qt)/bin:$PATH
export LIBRARY_PATH=$(brew --prefix)/lib:$LIBRARY_PATH
export CPATH=$(brew --prefix harfbuzz)/include/harfbuzz:$CPATH
export PKG_CONFIG_PATH=$(brew --prefix openssl@1.1)/lib/pkgconfig
sudo rm -rf /opt/ros/melodic
sudo mkdir -p /opt/ros/melodic
sudo chown $USER /opt/ros/melodic
./src/catkin/bin/catkin_make_isolated --install --install-space=/opt/ros/melodic \
--cmake-args -DCATKIN_ENABLE_TESTING=1 -DCMAKE_CXX_STANDARD=11 -DBoost_NO_BOOST_CMAKE=ON \
-DCMAKE_MACOSX_RPATH=ON -DCMAKE_INSTALL_RPATH="/opt/ros/melodic/lib" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_FIND_FRAMEWORK=LAST \
-DPYTHON_EXECUTABLE=$(which python3) \
-DPYTHON_LIBRARY=$(python3 -c "import sys; print(sys.prefix)")/lib/libpython3.7.dylib \
-DPYTHON_INCLUDE_DIR=$(python3 -c "import sys; print(sys.prefix)")/include/python3.7m -DGTEST_SRC_DIR="$(brew --prefix gtest)"
}
install_melodic