1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-10 07:04:03 +00:00

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@)
This commit is contained in:
Xin LI 2022-09-24 22:39:15 -07:00
parent 77b5fddc1e
commit dca15813a5
7 changed files with 142 additions and 14 deletions

View File

@ -1,5 +1,5 @@
PORTNAME= stellarsolver
DISTVERSION= 2.3
DISTVERSION= 2.4
CATEGORIES= astro
MAINTAINER= acm@FreeBSD.org

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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)
{

View File

@ -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