Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sci-astronomy/siril: fix one definition rule violation #36467

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
101 changes: 101 additions & 0 deletions sci-astronomy/siril/files/siril-1.2.1-options.patch
@@ -0,0 +1,101 @@
From 241b4b17d83285eb4bf4151dd77198427ac9fde4 Mon Sep 17 00:00:00 2001
From: Mario Haustein <mario.haustein@hrz.tu-chemnitz.de>
Date: Sun, 28 Apr 2024 14:09:19 +0200
Subject: [PATCH] Fix multiple definition of struct options
Upstream: https://gitlab.com/free-astro/siril/-/merge_requests/668
Bug: https://bugs.gentoo.org/927345

--- a/src/filters/deconvolution/estimate_kernel.cpp
+++ b/src/filters/deconvolution/estimate_kernel.cpp
@@ -33,7 +33,7 @@ extern "C" float *estimate_kernel(estk_data *args, int max_threads) {
if (!cppfftwmultithreaded)
max_threads = 1;
img_t<float>::use_threading(max_threads);
- options opts;
+ estimate_kernel_options opts;
opts.ks = args->ks;
opts.lambda = args->lambda;
opts.lambda_ratio = args->lambda_ratio;
--- a/src/filters/deconvolution/estimate_kernel.hpp
+++ b/src/filters/deconvolution/estimate_kernel.hpp
@@ -56,7 +56,7 @@ void gaussian_downsample(img_t<float>& out, const img_t<float>& _in, float facto
}
}

-struct options {
+struct estimate_kernel_options {
bool verbose;
int ks;
float lambda;
@@ -81,7 +81,7 @@ template <typename T>
class ImagePredictor {
public:
virtual void solve(img_t<T>& u, const img_t<T>& K, T lambda, T beta_init, T beta_rate, T beta_max,
- const options& opts) = 0;
+ const estimate_kernel_options& opts) = 0;
virtual ~ImagePredictor() {}
};

@@ -114,7 +114,7 @@ public:
}

void solve(img_t<T>& u, const img_t<T>& K,
- T lambda, T beta_init, T beta_rate, T beta_max, const options& opts) {
+ T lambda, T beta_init, T beta_rate, T beta_max, const estimate_kernel_options& opts) {
assert(K.w % 2);
assert(K.h % 2);

@@ -177,7 +177,7 @@ public:
template <typename T>
class KernelEstimator {
public:
- virtual void solve(img_t<T>& k, const img_t<T>& u, const struct options& opts) = 0;
+ virtual void solve(img_t<T>& k, const img_t<T>& u, const struct estimate_kernel_options& opts) = 0;
virtual ~KernelEstimator() {}
};

@@ -198,7 +198,7 @@ public:
}

// implements Algorithm 3
- void solve(img_t<T>& k, const img_t<T>& u, const struct options& opts) {
+ void solve(img_t<T>& k, const img_t<T>& u, const struct estimate_kernel_options& opts) {
k.resize(ks, ks);

// solves the Equation (28)
@@ -313,7 +313,7 @@ public:
fv = fft::r2c(v);
}

- void solve(img_t<T>& k, const img_t<T>& u, const struct options& opts) {
+ void solve(img_t<T>& k, const img_t<T>& u, const struct estimate_kernel_options& opts) {
if (k.w != ks || k.h != ks)
k.resize(ks, ks);

@@ -407,7 +407,7 @@ public:
// estimates the sharp image and the kernel from a blurry image and an initialization of u
template <typename T>
void l0_kernel_estimation(img_t<T>& k, img_t<T>& u, const img_t<T>& v,
- const img_t<T>& initu, struct options& opts) {
+ const img_t<T>& initu, struct estimate_kernel_options& opts) {
// static int it = 0;
ImagePredictor<T>* sharp_predictor = nullptr;
sharp_predictor = new L0ImagePredictor<T>(v);
@@ -463,7 +463,7 @@ void l0_kernel_estimation(img_t<T>& k, img_t<T>& u, const img_t<T>& v,
// it assumes that the image was previously processed by preprocess_image
// the inner loop is implemented in l0_kernel_estimation
template <typename T>
-void multiscale_l0_kernel_estimation(img_t<T>& k, img_t<T>& u, const img_t<T>& v, struct options& opts) {
+void multiscale_l0_kernel_estimation(img_t<T>& k, img_t<T>& u, const img_t<T>& v, struct estimate_kernel_options& opts) {
std::vector<img_t<T>> vs;
std::vector<int> kernelSizes;
printf("Multiscale kernel estimation...\n");
@@ -511,7 +511,7 @@ void multiscale_l0_kernel_estimation(img_t<T>& k, img_t<T>& u, const img_t<T>& v

// preprocess the input blurry image as describe in Section 2.1
template <typename T>
-void preprocess_image(img_t<T>& out, const img_t<T>& _v, struct options& opts) {
+void preprocess_image(img_t<T>& out, const img_t<T>& _v, struct estimate_kernel_options& opts) {
img_t<T> v(_v.w, _v.h);

// convert to grayscale
93 changes: 93 additions & 0 deletions sci-astronomy/siril/siril-1.2.1-r1.ebuild
@@ -0,0 +1,93 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit meson optfeature toolchain-funcs xdg

DESCRIPTION="A free astronomical image processing software"
HOMEPAGE="https://siril.org/"

if [[ ${PV} == "9999" ]]; then
inherit git-r3
EGIT_REPO_URI="https://gitlab.com/free-astro/${PN}.git"
else
SRC_URI="https://gitlab.com/free-astro/siril/-/archive/${PV/_/-}/${PN}-${PV/_/-}.tar.bz2"
KEYWORDS="~amd64 ~x86"
S="${WORKDIR}/${PN}-${PV/_/-}"
fi

LICENSE="GPL-3+ Boost-1.0"
SLOT="0"
IUSE="curl exif ffmpeg heif jpeg libconfig openmp png raw tiff wcs"

DEPEND="
>=dev-libs/glib-2.56.0:2
>=dev-libs/json-glib-1.2.6
media-libs/librtprocess
>=media-libs/opencv-4.4.0:=
sci-libs/cfitsio:=
sci-libs/fftw:3.0=
sci-libs/gsl:=
x11-libs/gdk-pixbuf:2
x11-libs/cairo
x11-libs/pango
>=x11-libs/gtk+-3.20.0:3
curl? ( net-misc/curl )
exif? ( >=media-gfx/exiv2-0.25:= )
ffmpeg? ( media-video/ffmpeg:= )
heif? ( media-libs/libheif:= )
jpeg? ( media-libs/libjpeg-turbo:= )
libconfig? ( >=dev-libs/libconfig-1.4:=[cxx] )
png? ( >=media-libs/libpng-1.6.0:= )
raw? ( media-libs/libraw:= )
tiff? ( media-libs/tiff:= )
wcs? ( >=sci-astronomy/wcslib-7.7:= )
"
RDEPEND="
${DEPEND}
"
BDEPEND="dev-build/cmake
x11-base/xorg-proto"

PATCHES=(
"${FILESDIR}/${PN}-docfiles.patch"
"${FILESDIR}/${PN}-1.2-fseek64-musl.patch"
"${FILESDIR}/${PN}-1.2.1-options.patch"
)

DOCS=( README.md NEWS ChangeLog AUTHORS )

pkg_pretend() {
[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
}

pkg_setup() {
[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
}

src_configure() {
local emesonargs=(
-Dffms2=false
-Dcriterion=false
$(meson_use exif exiv2)
$(meson_use ffmpeg)
$(meson_use heif libheif)
$(meson_use jpeg libjpeg)
$(meson_use libconfig)
$(meson_use openmp)
$(meson_use png libpng)
$(meson_use raw libraw)
$(meson_use tiff libtiff)
$(meson_use wcs wcslib)
$(usex curl -Denable-libcurl=yes -Denable-libcurl=no)
)
meson_src_configure
}

pkg_postinst() {
xdg_desktop_database_update
xdg_icon_cache_update
xdg_mimeinfo_database_update
optfeature "gnuplot support" sci-visualization/gnuplot
}