File Magics.spec of Package Magics
#
# spec file for package Magics
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%bcond_with metview
#---eccodes (unconditionally needed) no longer supports 32bit archs, so simply exclude them:
ExcludeArch: %{ix86} %{arm}
Name: Magics
Version: 4.16.0
Release: 0
Summary: Library and tools to visualize meteorological data and statistics
License: Apache-2.0
Group: Productivity/Scientific/Other
URL: https://confluence.ecmwf.int/display/MAGP/Magics
# Source repository at https://github.com/ecmwf/magics/
Source: https://confluence.ecmwf.int/download/attachments/3473464/%{name}-%{version}-Source.tar.gz
# PATCH-FEATURE-OPENSUSE rm-ksh.patch
Patch1: rm-ksh.patch
# PATCH-FIX-OPENSUSE fix-warnings.patch
Patch2: fix-warnings.patch
# PATCH-FEATURE-OPENSUSE reproducibility.patch
Patch3: reproducibility.patch
# PATCH-FEATURE-OPENSUSE reproducibility2.patch
Patch4: reproducibility2.patch
# PATCH-FEATURE-OPENSUSE python3.patch
Patch5: python3.patch
# PATCH-FEATURE-OPENSUSE magics-fix-vector-access.patch
Patch6: magics-fix-vector-access.patch
# PATCH-FEATURE-OPENSUSE g++14.patch
##Patch7: g++14.patch
# PATCH-FEATURE-OPENSUSE g++15.patch
Patch8: g++15.patch
BuildRequires: cmake >= 3.12
BuildRequires: make
BuildRequires: gcc-c++
BuildRequires: cairo-devel
BuildRequires: eccodes-devel >= 2.24.0
BuildRequires: hdf5-devel >= 1.8.8
BuildRequires: libaec-devel
BuildRequires: libgeotiff-devel >= 1.4.2
BuildRequires: libpng-devel
BuildRequires: libsz2-devel
BuildRequires: netcdf-devel
BuildRequires: openjpeg2
BuildRequires: openjpeg2-devel
BuildRequires: pango-devel
BuildRequires: perl
BuildRequires: perl-XML-Parser
BuildRequires: pkgconfig
BuildRequires: proj-devel
BuildRequires: sed
%if 0%{?suse_version}
BuildRequires: fdupes
BuildRequires: gcc-fortran
BuildRequires: libexpat-devel
BuildRequires: python3-base
%else
BuildRequires: gcc-gfortran
BuildRequires: expat-devel
BuildRequires: python3
%endif
%if %{with metview}
BuildRequires: cmake(Qt5Widgets)
%endif
%description
Latest generation of the ECMWF's Meteorological plotting software.
It supports the plotting of contours, wind fields, observations,
satellite images, symbols, text, axis and graphs (including boxplots).
Input may be GRIB 1 and 2, NetCDF and BUFR.
Plots can be saved in various formats, such as PostScript, EPS, PDF,
GIF, PNG and SVG.
%package devel
Summary: Developing package for Magics
Group: Development/Libraries/C and C++
Requires: %{name} = %{version}-%{release}
%description devel
This package contains the files needed for compiling programs using
the Magics library.
%prep
%autosetup -p1 -n "%{name}-%{version}-Source"
%build
%cmake \
-DCMAKE_PREFIX_PATH="%{_prefix}" \
-DCMAKE_INSTALL_PREFIX="%{_prefix}" \
-DCMAKE_C_FLAGS:STRING="%{optflags} -I%{_includedir}/libgeotiff" \
-DCMAKE_CXX_FLAGS:STRING="%{optflags} -I%{_includedir}/libgeotiff -Wno-deprecated-declarations -Wno-unused-local-typedefs" \
-DCMAKE_SHARED_LINKER_FLAGS="%{?build_ldflags:%{build_ldflags}} -Wl,--as-needed -Wl,-z,now" \
-DCMAKE_SKIP_RPATH=ON \
-DCMAKE_SKIP_INSTALL_RPATH=ON \
-DENABLE_RPATHS=OFF \
-DENABLE_RELATIVE_RPATHS=OFF \
-DINSTALL_LIB_DIR="%{_lib}" \
-DENABLE_CAIRO=ON \
-DENABLE_NETCDF=ON \
-DENABLE_GEOTIFF=ON \
-DGEOTIFF_INCLUDE_DIR=%{_includedir}/libgeotiff \
%if %{with metview}
-DENABLE_METVIEW=ON \
-DENABLE_QT5=ON \
%endif
-DHAVE_BIT_REPRODUCIBLE=ON
%cmake_build
%install
%cmake_install
#---env-shebangs generate warning / error messages:
sed -i -e '1 s|/usr/bin/env python.*|/usr/bin/python3|' \
%{buildroot}%{_bindir}/magicsCompatibilityChecker
sed -i '1 s|/usr/bin/env perl|/usr/bin/perl|' \
%{buildroot}%{_bindir}/metgram
%if 0%{?suse_version}
%{python3_fix_shebang}
%fdupes %{buildroot}%{_datadir}
%endif
%check
export LD_LIBRARY_PATH=/usr/lib64:/lib64:%{buildroot}%{_libdir}
export MAGPLUS_HOME=$PWD
%ctest
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%license LICENSE
%doc AUTHORS NOTICE
%{_bindir}/magics
%{_bindir}/magicsCompatibilityChecker
%{_bindir}/magjson
%{_bindir}/magjsonx
%{_bindir}/magml
%{_bindir}/magmlx
%{_bindir}/metgram
%{_bindir}/metgram.sh
%{_bindir}/metgramx
%{_libdir}/libMagPlus.so
%{_libdir}/libMagPlusDouble.so
%{_libdir}/libMagPlusSingle.so
%{_datadir}/*
%files devel
%{_includedir}/magics
%{_libdir}/cmake/magics
%changelog