sci-libs/alglib: add 3.20.0, bump EAPI 7 -> 8, fix build w/ cmake-4

This bump is moving headers into an alglib subdir.

I did not find any Changelogs available so even though 4.05.0 is available,
last version <4 is as high as I am willing to go to keep this in ::gentoo.

CMakelists.txt improvements over 3.8.2:
- Use Fedora CMakeLists.txt as template, bump to 3.10 min req ver
- Make PROJECT_VERSION and SOVERSION configurable as cmake arguments
- Use BUILD_TESTING standard CTest switch

Closes: https://bugs.gentoo.org/957965
Closes: https://bugs.gentoo.org/957966
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
This commit is contained in:
Andreas Sturmlechner
2025-09-29 18:53:46 +02:00
parent 916a7e7933
commit 11e9156df5
3 changed files with 86 additions and 0 deletions

View File

@@ -1 +1,2 @@
DIST alglib-3.17.0.cpp.gpl.tgz 3065026 BLAKE2B bc939568a6bfb5e2717995e31b9d7cb485885217ff8d15c2bea3185b1ef62536766f80e02d43999c016e24b10181bddd4ad4ff27611ab19ebcc778a5cb15d55e SHA512 0e4b943b03707950813aea707ae3569ce75a22216c9a4b256b646db16609995b3b63a958b0b8fbe3d7d623d5ac03efbe7c4b1589961f2ca9cdefbd7e1cc0c721
DIST alglib-3.20.0.cpp.gpl.tgz 3325551 BLAKE2B bfc62cada202ed6becfd01a62cd6e9b46f500e0e4670e30422581880b825cdf3fcdc1b4b3197c0ce3a5a28c580eab83889b0c70769a38a78d9ed7e116e7cd013 SHA512 badd8789ab561d3345d7b3d75aa95732f5d0e1e44125ee4d8c2b3f89ef2ec44137206b9e869a89daeafd1e1f8efbd8240ad1cbde7ba8002748de9d8f525b970e

View File

@@ -0,0 +1,38 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
ALGLIB_SOVER=$(ver_cut 1-2)
inherit cmake flag-o-matic
DESCRIPTION="Numerical analysis and data processing library"
HOMEPAGE="https://www.alglib.net/"
SRC_URI="https://www.alglib.net/translator/re/${P}.cpp.gpl.tgz"
S="${WORKDIR}"/${PN}-cpp
LICENSE="GPL-2+"
SLOT="0/${ALGLIB_SOVER}"
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
IUSE="test"
RESTRICT="!test? ( test )"
src_prepare() {
cp "${FILESDIR}"/CMakeLists.txt-3.20.0 CMakeLists.txt || die
cmake_src_prepare
}
src_configure() {
# bug #862666
append-flags -fno-strict-aliasing
filter-lto
use x86 && append-cflags -ffloat-store
local mycmakeargs=(
-DALGLIB_VERSION=${PV}
-DALGLIB_SOVERSION=${ALGLIB_SOVER}
-DBUILD_TESTING=$(usex test)
)
cmake_src_configure
}

View File

@@ -0,0 +1,47 @@
cmake_minimum_required(VERSION 3.10)
# Based on: https://src.fedoraproject.org/rpms/alglib/blob/rawhide/f/CMakeLists.txt
set(ALGLIB_VERSION "" CACHE STRING "Package version")
set(ALGLIB_SOVERSION "" CACHE STRING "Shared library target ABI version")
project(alglib
VERSION ${ALGLIB_VERSION}
LANGUAGES CXX
)
include(GNUInstallDirs)
include(CTest)
file(GLOB_RECURSE HDR RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/*.h)
file(GLOB_RECURSE SRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/*.cpp)
add_library(alglib SHARED ${SRC})
set_target_properties(alglib PROPERTIES
SOVERSION ${ALGLIB_SOVERSION}
VERSION ${PROJECT_VERSION}
)
target_include_directories(alglib PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
)
install(TARGETS alglib)
install(FILES ${HDR} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alglib)
if (BUILD_TESTING)
foreach(test IN ITEMS
test_c
test_i
# test_x
)
add_executable(${test} tests/${test}.cpp)
target_compile_definitions(${test} PRIVATE
AE_USE_ALLOC_COUNTER
AE_DEBUG4POSIX
)
target_link_libraries(${test} PRIVATE alglib)
add_test(NAME ${test}
COMMAND ${test}
)
endforeach()
endif()