summaryrefslogtreecommitdiff
path: root/web-video-server.spec
blob: 82db6ab862c7d6853572fac4b7c0e193fe6c3905 (plain)
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
%define ros_distro humble
%define RosPkgName web-video-server
%define src_version 3.1.0-1

Name:           ros-%{ros_distro}-%{RosPkgName}
Version:        3.1.0
Release:        3%{?dist}
Summary:        HTTP Streaming of ROS Image Topics in Multiple Formats
License:        BSD
URL:            https://github.com/RobotWebTools/web_video_server/tree/ros2
Source0:        %{RosPkgName}-%{src_version}.tar.gz

%global debug_package %{nil}
%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
%global __provides_exclude_from ^/opt/ros/%{ros_distro}/.*$
%global __requires_exclude_from ^/opt/ros/%{ros_distro}/.*$

BuildRequires:  cmake
BuildRequires:  ros-%{ros_distro}-ament-cmake
BuildRequires:  ros-%{ros_distro}-ament-cmake-ros
BuildRequires:  ros-%{ros_distro}-async-web-server-cpp
BuildRequires:  ros-%{ros_distro}-cv-bridge
BuildRequires:  ros-%{ros_distro}-image-transport
BuildRequires:  ros-%{ros_distro}-pluginlib
BuildRequires:  ros-%{ros_distro}-rclcpp
BuildRequires:  ros-%{ros_distro}-rclcpp-components
BuildRequires:  ros-%{ros_distro}-rmw
BuildRequires:  ros-%{ros_distro}-sensor-msgs
BuildRequires:  boost-devel
BuildRequires:  ffmpeg-devel
BuildRequires:  opencv
BuildRequires:  pkgconfig

Requires:       ros-%{ros_distro}-ros-workspace
Requires:       ros-%{ros_distro}-ament-cmake
Requires:       ros-%{ros_distro}-async-web-server-cpp
Requires:       ros-%{ros_distro}-cv-bridge
Requires:       ros-%{ros_distro}-image-transport
Requires:       ros-%{ros_distro}-pluginlib
Requires:       ros-%{ros_distro}-rclcpp
Requires:       ros-%{ros_distro}-rclcpp-components
Requires:       ros-%{ros_distro}-rmw
Requires:       ros-%{ros_distro}-sensor-msgs
Requires:       boost-devel
Requires:       ffmpeg-devel
Requires:       opencv

Provides:       %{name}-devel = %{version}-%{release}
Provides:       %{name}-doc = %{version}-%{release}
Provides:       %{name}-runtime = %{version}-%{release}

%description
HTTP Streaming of ROS Image Topics in Multiple Formats

%prep
%autosetup -n %{RosPkgName}-%{src_version}

%build
[ -f /opt/ros/%{ros_distro}/setup.sh ] && source /opt/ros/%{ros_distro}/setup.sh || true
export PYTHONPATH=/opt/ros/%{ros_distro}/lib/python%{python3_version}/site-packages${PYTHONPATH:+:$PYTHONPATH}
export PKG_CONFIG_PATH=/opt/ros/%{ros_distro}/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}

# Fix Boost version format mismatch: installed ROS cmake configs (e.g.
# async_web_server_cpp) hardcode find_dependency(Boost 108300) using old
# numeric Boost version. CMake FindBoost cannot parse 108300 as X.Y version
# (error at line 1654) and comparison 1.83.0 >= 108300 fails.
# Round 1 used find -exec sed {} + which silently failed (find returned
# non-zero, target file NOT patched). This round uses two approaches:
#
# Approach 1: directly sed the known file + while-read sweep (avoids {} + )
sed -i -E 's/(find_dependency|find_package)\([[:space:]]*Boost[[:space:]]+[0-9][0-9.]*/\1(Boost/g' \
    /opt/ros/%{ros_distro}/share/async_web_server_cpp/cmake/find_dependencies.cmake 2>/dev/null || true
find /opt/ros/%{ros_distro}/share -name '*.cmake' -print 2>/dev/null | while IFS= read -r _f; do
    sed -i -E 's/(find_dependency|find_package)\([[:space:]]*Boost[[:space:]]+[0-9][0-9.]*/\1(Boost/g' "$_f" 2>/dev/null || true
done
#
# Approach 2: custom FindBoost.cmake wrapper as CMake-level fallback.
# Intercepts find_package(Boost 108300) at module layer, clears the numeric
# version, then delegates to the real FindBoost.cmake. This catches any
# Boost version check regardless of which cmake config triggers it.
mkdir -p .obj/cmake/Modules
cat > .obj/cmake/Modules/FindBoost.cmake << 'BOOST_OVERRIDE'
if(DEFINED Boost_FIND_VERSION)
  message(STATUS "FindBoost wrapper: clearing version ${Boost_FIND_VERSION}")
endif()
unset(Boost_FIND_VERSION)
unset(Boost_FIND_VERSION_MAJOR)
unset(Boost_FIND_VERSION_MINOR)
unset(Boost_FIND_VERSION_PATCH)
unset(Boost_FIND_VERSION_EXACT)
set(_bw_dir ${CMAKE_CURRENT_LIST_DIR})
list(REMOVE_ITEM CMAKE_MODULE_PATH ${_bw_dir})
include(/usr/share/cmake/Modules/FindBoost.cmake)
list(APPEND CMAKE_MODULE_PATH ${_bw_dir})
BOOST_OVERRIDE

cd .obj
_boost_mod_dir="$(pwd)/cmake/Modules"
%cmake3 \
    -DCMAKE_INSTALL_PREFIX="/opt/ros/%{ros_distro}" \
    -DAMENT_PREFIX_PATH="/opt/ros/%{ros_distro}" \
    -DCMAKE_PREFIX_PATH="/opt/ros/%{ros_distro}" \
    -DCMAKE_MODULE_PATH="${_boost_mod_dir}" \
    -UINCLUDE_INSTALL_DIR -ULIB_INSTALL_DIR -USYSCONF_INSTALL_DIR -USHARE_INSTALL_PREFIX -ULIB_SUFFIX \
    -DSETUPTOOLS_DEB_LAYOUT=OFF \
    -DBUILD_TESTING=OFF -DTESTING=OFF -DCMAKE_SUPPRESS_REGENERATION=ON \
    ..
make %{?_smp_mflags}

%install
[ -f /opt/ros/%{ros_distro}/setup.sh ] && source /opt/ros/%{ros_distro}/setup.sh || true
export PYTHONPATH=/opt/ros/%{ros_distro}/lib/python%{python3_version}/site-packages${PYTHONPATH:+:$PYTHONPATH}
export PKG_CONFIG_PATH=/opt/ros/%{ros_distro}/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}
cd .obj
make install DESTDIR=%{buildroot}

%files
/opt/ros/%{ros_distro}

%changelog
* Thu Sep 24 2026 ai-importer <ai-importer@openeuler.org> - 3.1.0-3
- Fix Boost version mismatch: replace failed find -exec sed with direct
  sed on find_dependencies.cmake + while-read sweep, and add custom
  FindBoost.cmake wrapper to intercept version checks at CMake module layer

* Thu Sep 24 2026 ai-importer <ai-importer@openeuler.org> - 3.1.0-2
- Fix Boost version format mismatch: strip numeric version (108300) from
  find_dependency(Boost ...) calls in installed ROS cmake config files

* Thu Sep 24 2026 ai-importer <ai-importer@openeuler.org> - 3.1.0-1
- Initial import (ROS batch)