File omc.spec of Package omc
#
# spec file for package omc
#
# Copyright (c) 2024 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_without rpm_macros
Name: omc
Version: 1
Release: 0
License: EPL-1.0 OR GPL-3.0-only
URL: https://openmodelica.org
Group: Productivity/Scientific/Other
Summary: OpenModelica Compiler
Source6: omc-rpmlintrc
Patch1: Makefile.in.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: cmake
BuildRequires: flex
BuildRequires: gcc-c++
BuildRequires: gcc-fortran
BuildRequires: make
BuildRequires: jre
BuildRequires: lapack-devel
BuildRequires: libcurl-devel
BuildRequires: libexpat-devel
BuildRequires: libtool
BuildRequires: lpsolve-devel
BuildRequires: openblas-devel
BuildRequires: pkgconfig
BuildRequires: zlib-devel
%if "%_repository" == "ScientificLinux_7" || "%_repository" == "CentOS_7"
BuildRequires: epel-rpm-macros
%endif
%if ! %{with rpm_macros}
BuildRequires: OpenModelica-rpm-macros
%endif
BuildRequires: patchelf
Requires: %{name}-base
Requires: glibc-devel
Requires: openblas-devel
Requires: zlib-devel
# This was copied verbatim from example
BuildRoot: %{_tmppath}/%{name}-%{version}-build
# BuildArch:
%package examples
Summary: OpenModelica Compiler examples
Group: Productivity/Scientific/Other
BuildArch: noarch
Requires: omc-base
%package base
Summary: OpenModelica Compiler base directories
Group: Productivity/Scientific/Other
BuildArch: noarch
%if %{with rpm_macros}
%package rpm-macros
Summary: RPM macros for building OpenModelica suite
Group: Productivity/Scientific/Other
BuildArch: noarch
%endif
%description
omc is the OpenModelica core. It transpiles modelica models (*.mo) into a
C source which solves the differential equations for the model.
%description examples
omc is the OpenModelica core. It transpiles modelica models (*.mo) into a
C source which solves the differential equations for the model.
This package contains example models (*.mo)
%description base
OpenModelica Compiler base directories are shared between
other packages in the suite.
%if %{with rpm_macros}
%description rpm-macros
RPM macros for helping in building other OpenModelica packages
%endif
%define sourcedir %{_sourcedir}/OpenModelica-%{version}
%prep
%define exclude() mv %1 %1.nobuild
cd %sourcedir
%{exclude OMSimulator}
%{exclude OMPlot}
%{exclude OMParser}
%{exclude OMSens_Qt}
%{exclude OMNotebook}
%{exclude OMShell}
%{exclude OMEdit}
echo v%{version} > %{sourcedir}/REVISION
cd %{sourcedir}
%patch1 -p3
%build
SUSE_ASNEEDED=0
export SUSE_ASNEEDED
cd %{sourcedir}
%if "%_repository" == "opensuse_Tumbleweed"
autoupdate
%endif
autoconf
%om_setup CC="gcc -std=gnu99"
make omc
touch omplot.skip
touch omsimulator.skip
touch omparser.skip
touch omedit.skip
%install
cd %{sourcedir}
make install DESTDIR=%{buildroot}
patchelf --remove-rpath %{buildroot}/%{openmodelicahome}/lib/x86_64-linux-gnu/omc/libipopt.so*
mkdir -p %{buildroot}/%{_bindir}
ln -s %{openmodelicahome}/bin/omc %{buildroot}/%{_bindir}
mkdir -p %buildroot/%_datadir/OpenModelica
mv %buildroot%openmodelicahome/share/doc/omc/testmodels %{buildroot}%_datadir/OpenModelica/examples
mv %buildroot%openmodelicahome/share/doc/omc/COPYING %_builddir
mv %buildroot%openmodelicahome/share/doc/omc/*.pdf %_builddir
rmdir %{buildroot}%openmodelicahome/share/doc/omc
rmdir %buildroot%openmodelicahome/share/doc
mkdir -p %buildroot%openmodelicahome/lib/omlibrary
%if %{with rpm_macros}
%__mkdir_p %{buildroot}%{_rpmmacrodir}
cat >> %{buildroot}%{_rpmmacrodir}/macros.openmodelica <<-EOF
%%openmodelicahome %openmodelicahome
%%om_setup %%{expand:%om_setup_unexpanded}
%%omdocdir %omdocdir
EOF
%endif
%files
%defattr(-,root,root,-)
%{_bindir}/omc
%openmodelicahome/share/omc
%{openmodelicahome}/bin/omc
%dir %{openmodelicahome}/lib/omc
%{openmodelicahome}/lib/omc/*.mo
%{openmodelicahome}/lib/x86_64-linux-gnu/omc/
%openmodelicahome/include/omc
%openmodelicahome/include/x86_64-linux-gnu/omc
%license COPYING
%doc *.pdf
%files examples
%dir %_datadir/OpenModelica/examples
%_datadir/OpenModelica/examples
%license COPYING
%files base
%dir %{openmodelicahome}
%dir %{openmodelicahome}/bin
%dir %{openmodelicahome}/lib
%dir %{openmodelicahome}/lib/omlibrary
%dir %{openmodelicahome}/lib/x86_64-linux-gnu
%dir %{openmodelicahome}/lib/x86_64-linux-gnu/omc
%dir %{openmodelicahome}/include
%dir %{openmodelicahome}/include/omc
%dir %{openmodelicahome}/include/x86_64-linux-gnu
%dir %{openmodelicahome}/include/x86_64-linux-gnu/omc
%dir %openmodelicahome/share
%dir %_datadir/OpenModelica
%if %{with rpm_macros}
%files rpm-macros
%{_rpmmacrodir}/macros.openmodelica
%endif
%changelog