git: dca15813a52d - main - astro/stellarsolver: Upgrade to 2.4 and fix build on -CURRENT with GNU qsort_r.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 25 Sep 2022 05:39:30 UTC
The branch main has been updated by delphij: URL: https://cgit.FreeBSD.org/ports/commit/?id=dca15813a52d4a44c7a76ad28a7c1b75a1392334 commit dca15813a52d4a44c7a76ad28a7c1b75a1392334 Author: Xin LI <delphij@FreeBSD.org> AuthorDate: 2022-09-25 05:39:15 +0000 Commit: Xin LI <delphij@FreeBSD.org> CommitDate: 2022-09-25 05:39:16 +0000 astro/stellarsolver: Upgrade to 2.4 and fix build on -CURRENT with GNU qsort_r. PR: ports/266227, ports/266574 Reported by: antoine (via exp-run) Approved by: maintainer (acm@) --- astro/stellarsolver/Makefile | 2 +- astro/stellarsolver/distinfo | 6 +- astro/stellarsolver/files/patch-CMakeLists.txt | 49 ++++++++++++++ .../patch-stellarsolver_astrometry_os-features.h | 11 ++++ ...tellarsolver_astrometry_util_os-features-test.c | 75 ++++++++++++++++++++++ .../files/patch-stellarsolver_stellarsolver.cpp | 4 +- astro/stellarsolver/pkg-plist | 9 +-- 7 files changed, 142 insertions(+), 14 deletions(-) diff --git a/astro/stellarsolver/Makefile b/astro/stellarsolver/Makefile index d510b60f4c24..93434f654700 100644 --- a/astro/stellarsolver/Makefile +++ b/astro/stellarsolver/Makefile @@ -1,5 +1,5 @@ PORTNAME= stellarsolver -DISTVERSION= 2.3 +DISTVERSION= 2.4 CATEGORIES= astro MAINTAINER= acm@FreeBSD.org diff --git a/astro/stellarsolver/distinfo b/astro/stellarsolver/distinfo index b0f9d77b2eca..3e70fb11bd98 100644 --- a/astro/stellarsolver/distinfo +++ b/astro/stellarsolver/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1653202874 -SHA256 (rlancaste-stellarsolver-2.3_GH0.tar.gz) = c2747339af853a1a8147a4b9eba23f0a621912018b30a0b5a9aba9f557d2b9bc -SIZE (rlancaste-stellarsolver-2.3_GH0.tar.gz) = 23403038 +TIMESTAMP = 1663948663 +SHA256 (rlancaste-stellarsolver-2.4_GH0.tar.gz) = e9cf7e73edb96a959f75dbbba16bd5e270f6e95c0d5c3dfa8727dfaf77d0617f +SIZE (rlancaste-stellarsolver-2.4_GH0.tar.gz) = 23402982 diff --git a/astro/stellarsolver/files/patch-CMakeLists.txt b/astro/stellarsolver/files/patch-CMakeLists.txt new file mode 100644 index 000000000000..cc35eb8cca54 --- /dev/null +++ b/astro/stellarsolver/files/patch-CMakeLists.txt @@ -0,0 +1,49 @@ +--- CMakeLists.txt.orig 2022-07-29 16:11:55 UTC ++++ CMakeLists.txt +@@ -58,29 +58,25 @@ else(WIN32) + + else(WIN32) + +-try_run(RUN_RESULT_2 COMPILE_SUCCESS_2 ${CMAKE_CURRENT_BINARY_DIR} ${config_SRCS} COMPILE_DEFINITIONS -DTEST_DECLARE_QSORT_R=ON) +-if(COMPILE_SUCCESS_2 AND (RUN_RESULT_2 EQUAL 0)) +- SET(VAR_2 0) ++try_run(RUN_RESULT_BSD_QSORT_R COMPILE_SUCCESS_BSD_QSORT_R ${CMAKE_CURRENT_BINARY_DIR} ${config_SRCS} COMPILE_DEFINITIONS -DTEST_BSD_QSORT_R=ON) ++try_run(RUN_RESULT_GNU_QSORT_R COMPILE_SUCCESS_GNU_QSORT_R ${CMAKE_CURRENT_BINARY_DIR} ${config_SRCS} COMPILE_DEFINITIONS -DTEST_GNU_QSORT_R=ON) ++if(COMPILE_SUCCESS_GNU_QSORT_R AND (RUN_RESULT_GNU_QSORT_R EQUAL 0)) ++ SET(WANT_DECLARE_QSORT_R 0) ++ SET(WANT_BUNDLED_QSORT_R 0) ++ SET(WANT_SWAP_QSORT_R 1) + else() +- SET(VAR_2 1) ++ SET(WANT_SWAP_QSORT_R 0) ++ if(COMPILE_SUCCESS_BSD_QSORT_R AND (RUN_RESULT_BSD_QSORT_R EQUAL 0)) ++ SET(WANT_DECLARE_QSORT_R 0) ++ SET(WANT_BUNDLED_QSORT_R 0) ++ else() ++ SET(WANT_DECLARE_QSORT_R 1) ++ SET(WANT_BUNDLED_QSORT_R 1) ++ endif() + endif() +-file(APPEND "${config_FN}" "#define NEED_DECLARE_QSORT_R ${VAR_2}\n") +- +-try_run(RUN_RESULT_3 COMPILE_SUCCESS_3 ${CMAKE_CURRENT_BINARY_DIR} ${config_SRCS} COMPILE_DEFINITIONS -DTEST_QSORT_R=ON) +-if(COMPILE_SUCCESS_3 AND (RUN_RESULT_3 EQUAL 0)) +- SET(VAR_3 1) +-else() +- SET(VAR_3 0) +-endif() +-file(APPEND "${config_FN}" "#define NEED_QSORT_R ${VAR_3}\n") +- +-try_run(RUN_RESULT_4 COMPILE_SUCCESS_4 ${CMAKE_CURRENT_BINARY_DIR} ${config_SRCS} COMPILE_DEFINITIONS -DTEST_SWAP_QSORT_R=ON) +-if(COMPILE_SUCCESS_4 AND (RUN_RESULT_4 EQUAL 0)) +- SET(VAR_4 1) +-else() +- SET(VAR_4 0) +-endif() +-file(APPEND "${config_FN}" "#define NEED_SWAP_QSORT_R ${VAR_4}\n") ++file(APPEND "${config_FN}" "#define NEED_DECLARE_QSORT_R ${WANT_DECLARE_QSORT_R}\n") ++file(APPEND "${config_FN}" "#define NEED_SWAP_QSORT_R ${WANT_SWAP_QSORT_R}\n") ++file(APPEND "${config_FN}" "#define NEED_QSORT_R ${WANT_BUNDLED_QSORT_R}\n") + + endif(WIN32) + diff --git a/astro/stellarsolver/files/patch-stellarsolver_astrometry_os-features.h b/astro/stellarsolver/files/patch-stellarsolver_astrometry_os-features.h new file mode 100644 index 000000000000..14f21b96aa81 --- /dev/null +++ b/astro/stellarsolver/files/patch-stellarsolver_astrometry_os-features.h @@ -0,0 +1,11 @@ +--- stellarsolver/astrometry/os-features.h.orig 2022-07-29 16:11:55 UTC ++++ stellarsolver/astrometry/os-features.h +@@ -110,7 +110,7 @@ + + #if NEED_DECLARE_QSORT_R + //// NOTE: this declaration must match os-features-test.c . +-void qsort_r(void *base, size_t nmemb, size_t sz, ++void (qsort_r)(void *base, size_t nmemb, size_t sz, + void *userdata, + int (*compar)(void *, const void *, const void *)); + #endif diff --git a/astro/stellarsolver/files/patch-stellarsolver_astrometry_util_os-features-test.c b/astro/stellarsolver/files/patch-stellarsolver_astrometry_util_os-features-test.c new file mode 100644 index 000000000000..de338b4fc2a9 --- /dev/null +++ b/astro/stellarsolver/files/patch-stellarsolver_astrometry_util_os-features-test.c @@ -0,0 +1,75 @@ +--- stellarsolver/astrometry/util/os-features-test.c.orig 2022-07-29 16:11:55 UTC ++++ stellarsolver/astrometry/util/os-features-test.c +@@ -14,7 +14,11 @@ int main() { + } + #endif + +-#ifdef TEST_QSORT_R ++#ifdef TEST_BSD_QSORT_R ++void (qsort_r)(void *base, size_t nmemb, size_t sz, ++ void *userdata, ++ int (*compar)(void *, const void *, const void *)); ++ + static int cmp(void* u, const void* a, const void* b) { + return 0; + } +@@ -22,51 +26,22 @@ int main() { + int array; + int baton; + qsort_r(&array, 1, sizeof(int), &baton, cmp); +- //printf("#define NEED_QSORT_R 0\n"); + return 0; + } + #endif + +-#ifdef TEST_DECLARE_QSORT_R +-// Test whether just declaring qsort_r as we do causes a compile failure. ++#ifdef TEST_GNU_QSORT_R ++void (qsort_r)(void *base, size_t nmemb, size_t sz, ++ int (*compar)(const void *, const void *, void *), ++ void *userdata); + +-void qsort_r(void *base, size_t nmemb, size_t sz, +- void *userdata, +- int (*compar)(void *, const void *, const void *)); +- +-int main() { +- //printf("#define NEED_DECLARE_QSORT_R 1\n"); ++static int cmp(const void* a, const void* b, void* u) { + return 0; + } +-#endif +- +-#ifdef TEST_SWAP_QSORT_R +-// Use the result of TEST_DECLARE_QSORT_R and TEST_NEED_QSORT_R, or else +-// this test will fail with a warning about undefined qsort_r +-// Include .c rather than .h because we test with: +-// gcc -o (exec) os-features-test.c +-// and if NEED_QSORT_R, os-features.c includes qsort_reentrant.c +-#include "os-features-config.h.tmp" +-#define DONT_INCLUDE_OS_FEATURES_CONFIG_H 1 +-#include "os-features.c" +-#undef DONT_INCLUDE_OS_FEATURES_CONFIG_H +-// Test whether qsort_r works unswapped. (ie, qsort_r matches the definition of +-// QSORT_R defined in the os-features.h documentation.) +-static int sortfunc(void* thunk, const void* v1, const void* v2) { +- const int* i1 = v1; +- const int* i2 = v2; +- if (*i1 < *i2) +- return -1; +- if (*i1 > *i2) +- return 1; +- return 0; +-} + int main() { +- int array[] = { 4, 17, 88, 34, 12, 12, 17 }; +- int N = sizeof(array)/sizeof(int); +- int mythunk = 42; +- qsort_r(array, N, sizeof(int), &mythunk, sortfunc); +- //printf("#define NEED_SWAP_QSORT_R 0\n"); ++ int array; ++ int baton; ++ qsort_r(&array, 1, sizeof(int), cmp, &baton); + return 0; + } + #endif diff --git a/astro/stellarsolver/files/patch-stellarsolver_stellarsolver.cpp b/astro/stellarsolver/files/patch-stellarsolver_stellarsolver.cpp index 0516e3bb9e6c..ea540aa0169f 100644 --- a/astro/stellarsolver/files/patch-stellarsolver_stellarsolver.cpp +++ b/astro/stellarsolver/files/patch-stellarsolver_stellarsolver.cpp @@ -1,4 +1,4 @@ ---- stellarsolver/stellarsolver.cpp.orig 2020-11-15 04:11:58 UTC +--- stellarsolver/stellarsolver.cpp.orig 2022-07-29 16:11:55 UTC +++ stellarsolver/stellarsolver.cpp @@ -7,6 +7,9 @@ */ @@ -10,7 +10,7 @@ #elif defined(_WIN32) #include "windows.h" #else //Linux -@@ -799,8 +802,12 @@ bool StellarSolver::appendStarsRAandDEC(QList<FITSImag +@@ -987,8 +990,12 @@ bool StellarSolver::getAvailableRAM(double &availableR //But from what I read, getting the Available RAM is inconsistent and buggy on many systems. bool StellarSolver::getAvailableRAM(double &availableRAM, double &totalRAM) { diff --git a/astro/stellarsolver/pkg-plist b/astro/stellarsolver/pkg-plist index 66b109af9653..b79fb77156cc 100644 --- a/astro/stellarsolver/pkg-plist +++ b/astro/stellarsolver/pkg-plist @@ -72,18 +72,11 @@ lib/cmake/StellarSolver/StellarSolverConfig.cmake lib/cmake/StellarSolver/StellarSolverConfigVersion.cmake lib/libstellarsolver.so lib/libstellarsolver.so.2 -lib/libstellarsolver.so.2.3 +lib/libstellarsolver.so.2.4 libdata/pkgconfig/stellarsolver.pc share/applications/com.github.rlancaste.stellarbatchsolver.desktop -share/icons/.DS_Store -share/icons/hicolor/.DS_Store -share/icons/hicolor/128x128/.DS_Store share/icons/hicolor/128x128/apps/StellarBatchSolverIcon.png -share/icons/hicolor/16x16/.DS_Store share/icons/hicolor/16x16/apps/StellarBatchSolverIcon.png -share/icons/hicolor/32x32/.DS_Store share/icons/hicolor/32x32/apps/StellarBatchSolverIcon.png -share/icons/hicolor/48x48/.DS_Store share/icons/hicolor/48x48/apps/StellarBatchSolverIcon.png -share/icons/hicolor/64x64/.DS_Store share/icons/hicolor/64x64/apps/StellarBatchSolverIcon.png