Description: Fix CMake configure failure with libftdi pre-release version
 The build environment ships libftdi1 1.6~rc1, so pkg-config reports the
 version as "1.6rc1". CMakeLists.txt splits it at '.' and feeds the second
 component ("6rc1") into math(), which cannot parse the non-numeric rc
 suffix and aborts configuration. Strip everything from the first
 non-digit/non-dot character before computing the numeric version value.
Author: tangxiaofeng <tangxiaofeng@kylinos.cn>
Origin: other
Forwarded: not-needed
Last-Update: 2026-09-04

--- openfpgaloader-0.13.1.orig/CMakeLists.txt
+++ openfpgaloader-0.13.1/CMakeLists.txt
@@ -323,7 +323,9 @@ endif()
 
 # libftdi < 1.4 as no usb_addr
 # libftdi >= 1.5 as purge_buffer obsolete
-string(REPLACE "." ";" VERSION_LIST ${LIBFTDI_VERSION})
+# Strip pre-release suffixes (e.g. "1.6rc1" from 1.6~rc1) that break math()
+string(REGEX REPLACE "[^0-9.].*$" "" LIBFTDI_VERSION_CLEAN "${LIBFTDI_VERSION}")
+string(REPLACE "." ";" VERSION_LIST ${LIBFTDI_VERSION_CLEAN})
 list(GET VERSION_LIST 0 LIBFTDI_VERSION_MAJOR)
 list(GET VERSION_LIST 1 LIBFTDI_VERSION_MINOR)
 math(EXPR FTDI_VAL "${LIBFTDI_VERSION_MAJOR} * 100 + ${LIBFTDI_VERSION_MINOR}")
