Skip to content

Commit f7a7357

Browse files
sfowlclaude
andcommitted
packaging: build csdiff-static on RHEL-8 and newer
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent a950756 commit f7a7357

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

make-srpm.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ cat > "$SPEC" << EOF
8989
%bcond_without python2
9090
%endif
9191
92-
# build csdiff-static on 64bit RHEL-10+ and Fedora
93-
%if 0%{?__isa_bits} == 64 && (0%{?rhel} > 9 || 0%{?fedora})
92+
# build csdiff-static on 64bit RHEL-8+ and Fedora
93+
%if 0%{?__isa_bits} == 64 && (0%{?rhel} > 7 || 0%{?fedora})
9494
%bcond_without static
9595
%else
9696
%bcond_with static
@@ -150,7 +150,11 @@ defect lists using various filtering predicates.
150150
%if %{with static}
151151
%package static
152152
Summary: Statically linked csgrep-static executable
153+
%if 0%{?rhel} == 8 || 0%{?rhel} == 9
154+
BuildRequires: boost1.78-static
155+
%else
153156
BuildRequires: boost-static
157+
%endif
154158
BuildRequires: glibc-static
155159
BuildRequires: libstdc++-static
156160
@@ -195,6 +199,11 @@ code scan defect lists to find out added or fixed defects.
195199
export BOOST_INCLUDEDIR=/usr/include/boost169
196200
export BOOST_LIBRARYDIR=/usr/lib64/boost169
197201
%endif
202+
%if 0%{?rhel} == 8 || 0%{?rhel} == 9
203+
# Set paths for CMake's FindBoost
204+
export BOOST_INCLUDEDIR=/usr/include/boost1.78
205+
export BOOST_LIBRARYDIR=/usr/lib64/boost1.78
206+
%endif
198207
199208
make version.cc
200209
%if 0%{?rhel} == 7

src/CMakeLists.txt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,17 @@ if(CSGREP_STATIC)
102102
add_executable(csgrep-static csgrep.cc)
103103
target_link_options(csgrep-static PRIVATE "-static")
104104

105-
# FIXME: do not hardcode paths to boost static libs
105+
# Use BOOST_LIBRARYDIR if set, otherwise fallback to /usr/lib64
106+
if(DEFINED ENV{BOOST_LIBRARYDIR})
107+
set(Boost_STATIC_DIR "$ENV{BOOST_LIBRARYDIR}")
108+
else()
109+
set(Boost_STATIC_DIR "/usr/lib64")
110+
endif()
111+
106112
target_link_libraries(csgrep-static cs
107-
/usr/lib64/libboost_filesystem.a
108-
/usr/lib64/libboost_program_options.a
109-
/usr/lib64/libboost_regex.a)
113+
${Boost_STATIC_DIR}/libboost_filesystem.a
114+
${Boost_STATIC_DIR}/libboost_program_options.a
115+
${Boost_STATIC_DIR}/libboost_regex.a)
110116

111117
install(TARGETS csgrep-static
112118
DESTINATION ${CMAKE_INSTALL_LIBEXECDIR})

0 commit comments

Comments
 (0)