I was having the same build errors as @skualos and some other GCC 16 compatibility errors, the following prepare() function fixes them:
prepare() {
cd "${srcdir}/InsightToolkit-${pkgver}" || return
# CMake compatibility (update old policy versions)
find . \( -name CMakeLists.txt -o -name '*.cmake' -o -name '*.cmake.in' \) \
-exec perl -0777 -i -pe '
s{
cmake_minimum_required
\(VERSION\s+
(\d+)\.(\d+)(?:\.(\d+))?
(\s+FATAL_ERROR)?
\)
}{
($1 < 3 || ($1 == 3 && $2 < 5))
? "cmake_minimum_required(VERSION 3.5" . ($4 // "") . ")"
: $&
}giex;
s{
cmake_policy
\(VERSION\s+
(\d+)\.(\d+)(?:\.(\d+))?
\)
}{
($1 < 3 || ($1 == 3 && $2 < 5))
? "cmake_policy(VERSION 3.5)"
: $&
}giex;
' {} +
# GCC 16 compatibility (remove conflicting old-style prototypes)
perl -0pi -e '
s/^[ \t]*RealNumber[ \t]+FindBiggestInColExclude\(\);\n//mg;
s/^[ \t]*RealNumber[ \t]+FindLargestInCol\(\);\n//mg;
' Modules/ThirdParty/VNL/src/vxl/v3p/netlib/sparse/spFactor.c
# GCC 16 compatibility (fix MINC function pointer declarations)
perl -0pi -e '
s{
(case\s+ARGV_FUNC\s*:\s*\{\s*)
int\s+\(\*handlerProc\)\(\)\s*=\s*
\(int\s*\(\*\)\(\)\)\s*
\(uintptr_t\)infoPtr->src;
}{
$1
int (*handlerProc)(char *, char *, char *) =
(int (*)(char *, char *, char *))(uintptr_t)infoPtr->src;
}xs;
s{
(case\s+ARGV_GENFUNC\s*:\s*\{\s*)
int\s+\(\*handlerProc\)\(\)\s*=\s*
\(int\s*\(\*\)\(\)\)\s*
\(uintptr_t\)infoPtr->src;
}{
$1
int (*handlerProc)(char *, char *, int, char **) =
(int (*)(char *, char *, int, char **))(uintptr_t)infoPtr->src;
}xs;
' Modules/ThirdParty/MINC/src/libminc/libcommon/ParseArgv.c
}
Pinned Comments
m-pilia commented on 2021-03-28 14:19 (UTC) (edited on 2021-03-28 14:20 (UTC) by m-pilia)
NOTE: The main difference between this package and itk4 is that
itk4conflicts withinsight-toolkit(i.e. the latest ITK version), while this package can be installed in parallel and allows having both ITK4 and ITK5 available on the same system.