Name:		ros_comm
Version:	1.14.6
Release:	1
Summary:	This is ROS melodic ros_comm Package
License:	GPL
URL:		https://github.com/ros-gbp/ros_comm-release/archive/release/melodic/ros_comm
Source0:	https://github.com/ros-gbp/ros_comm-release/archive/release/melodic/ros_comm/1.14.6-1.tar.gz
BuildRequires:	gcc-c++
BuildRequires:	cmake
BuildRequires:	lz4-devel
BuildRequires:	bzip2-devel
BuildRequires:	python-devel
BuildRequires:	python-setuptools
BuildRequires:	openssl-devel
BuildRequires:	boost-devel

%description
This is ROS melodic ros_comm Package.

%install
cd 3rdparty/ 

cd empy-3.3.4/
python setup.py install --user
cd ..

cd six-1.15.0/
python setup.py install --user
cd ..

cd setuptools_scm-4.1.2/
python setup.py install --user
cd ..

cd python-dateutil-2.8.1/
python setup.py install --user
cd ..

cd pyparsing-2.4.7/
python setup.py install --user
cd ..

cd docutils-0.16/
python setup.py install --user
cd ..

cd catkin_pkg-0.4.22/
python setup.py install --user
cd ..


cd console_bridge/
mkdir build/
cd build/
cmake ..
make -j8
make install
cd ..
cd ..

cd poco/
mkdir cmake-build/
mkdir cmake-release/
cd cmake-build/
cmake ..
make -j8
make install
cd ..
cd ..


cd tinyxml2/
mkdir build
cd build
cmake ..
make -j8
make install
cd ..
cd ..


cd ..


./src/catkin/bin/catkin_make_isolated --install 

####
# 对install_isoloate内部的变量名称进行替换
#
####
SRC_PATH=$PWD/install_isolated
DST_PATH=/opt/ros/melodic
sed -i "s:${SRC_PATH}:${DST_PATH}:g"  `grep -rIln "${SRC_PATH}" install_isolated/*`

####
# 添加.catkin和.rosinstall文件
#
####
mkdir -p %{buildroot}/opt/ros/melodic/
mkdir -p %{buildroot}/usr/local/
cp -r install_isolated/* %{buildroot}/opt/ros/melodic/
cp  install_isolated/.rosinstall %{buildroot}/opt/ros/melodic/
cp  install_isolated/.catkin %{buildroot}/opt/ros/melodic/

%files
%defattr(-,root,root)
/opt/ros/melodic/*
/opt/ros/melodic/.rosinstall
/opt/ros/melodic/.catkin
/usr/local/*
%changelog
* Thu 12-15-2020 openEuler Buildteam <hanhaomin008@126.com>
- Package init

