File mingw64-ngspice.spec of Package mingw64-ngspice

#
# spec file for package mingw64
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#


%global flavor @BUILD_FLAVOR@%{nil}

%if "%flavor" == "shlibs"
%define build_shared 1
%endif
%define pname   ngspice

Name:           mingw64-%pname%{?build_shared:-shared}
%define so_ver 0
Version:        30
Release:        0
Summary:        Mixed-level, Mixed-signal Circuit Simulator Based on spice3f5
License:        BSD-2-Clause
Group:          Productivity/Scientific/Electronics
Url:            http://ngspice.sourceforge.net
Source0:        http://downloads.sourceforge.net/%{pname}/%{pname}-%{version}.tar.gz
Source1:        http://downloads.sourceforge.net/%{pname}/%{pname}-%{version}-manual.pdf
Patch1:         ngspice-Use-gnuplot-terminal-auto-detection.patch
Patch2:         0001-fix-undefined-malloc-on-cross-compile.patch
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  bison
BuildRequires:  flex
BuildRequires:  libtool
BuildRequires:  mingw64-cross-gcc
BuildRequires:  mingw64-cross-gcc-fortran
BuildRequires:  mingw64-cross-pkg-config
BuildRequires:  mingw64-fftw3-devel
# should be a dependency of cross gcc
BuildRequires:  mingw64-filesystem
BuildRequires:  mingw64-ncurses-devel
BuildRequires:  mingw64-readline-devel
BuildRequires:  mingw64-termcap-devel
Requires:       mingw64-%{pname}-scripts = %{version}
Requires:       mingw64-%{pname}-xspice-cm = %{version}
Requires:       mingw64-lib%{pname}%{so_ver} = %{version}
Recommends:     mingw64-%{pname}-doc = %{version}
Provides:       mingw64-ng-spice-rework = %{version}
%_mingw64_package_header_debug
BuildArch:      noarch

%_mingw64_debug_package

%description
Ngspice is a mixed-level/mixed-signal circuit simulator. Its code
is based on three open source software packages: Spice3f5, Cider1b1
and Xspice.

%package doc
Summary:        Documentation for ngspice
Group:          Documentation/Other
Requires:       mingw64-%{pname} = %{version}

%description doc
Ngspice is a mixed-level/mixed-signal circuit simulator. Its code
is based on three open source software packages: Spice3f5, Cider1b1
and Xspice.

%package xspice-cm
Summary:        Xspice code model Plugins
Group:          Productivity/Scientific/Electronics

%description xspice-cm
Ngspice is a mixed-level/mixed-signal circuit simulator. Its code
is based on three open source software packages: Spice3f5, Cider1b1
and Xspice. This package contains the Xspice code model plugins.

%package scripts
Summary:        Ngspice init scripts
Group:          Productivity/Scientific/Electronics

%description scripts
Ngspice is a mixed-level/mixed-signal circuit simulator. Its code
is based on three open source software packages: Spice3f5, Cider1b1
and Xspice. This package contains the ngspice init scripts shared
between ngspice and libngspice.


%package xspice-cm-devel
Summary:        Development files for Xspice code model plugins
Group:          Development/Libraries/Other
Requires:       mingw64-%{pname}-xspice-cm = %{version}

%description xspice-cm-devel
Ngspice is a mixed-level/mixed-signal circuit simulator. Its code
is based on three open source software packages: Spice3f5, Cider1b1
and Xspice. This package contains the development files for Xspice
code model plugins.

%package -n mingw64-lib%{pname}%{so_ver}
Summary:        Shared libraries for ngspice
Group:          System/Libraries
Requires:       mingw64-%{pname}-scripts
Requires:       mingw64-%{pname}-xspice-cm

%description -n mingw64-lib%{pname}%{so_ver}
Ngspice is a mixed-level/mixed-signal circuit simulator. Its code
is based on three open source software packages: Spice3f5, Cider1b1
and Xspice. This package contains the shared libraries.

%package -n mingw64-lib%{pname}-devel
Summary:        Development files for ngspice
Group:          Development/Libraries/Other
Requires:       mingw64-lib%{pname}%{so_ver} = %{version}

%description -n mingw64-lib%{pname}-devel
Ngspice is a mixed-level/mixed-signal circuit simulator. Its code
is based on three open source software packages: Spice3f5, Cider1b1
and Xspice. This package contains the development files.

%prep
%setup -q -n ngspice-%{version}
cp %{S:1} .
%patch -P 1 -p1
%patch -P 2 -p1

%build
./autogen.sh
%_mingw64_configure\
%if 0%{!?build_shared:1}
   --with-wingui \
%else
    --with-ngshared \
%endif   
    --with-readline=yes \
    --enable-xspice \
    --enable-cider \
    --enable-openmp

%_mingw64_make V=1 %{?_smp_mflags}

%install
%_mingw64_makeinstall
find %{buildroot} -type f -name "*.la" -delete -print
%if 0%{!?build_shared:1}
rm %{buildroot}%{_mingw64_includedir}/%{pname}/sharedspice.h
%else
rm -rf %{buildroot}%{_mingw64_bindir}/cmpp.exe %{buildroot}/%{_mingw64_mandir} \
       %{buildroot}%{_mingw64_libdir}/%{pname} \
       %{buildroot}%{_mingw64_datadir}/%{pname}/dlmain.c \
       %{buildroot}%{_mingw64_datadir}/%{pname}/scripts \
       %{buildroot}%{_mingw64_includedir}/%{pname}/[^s]*.h \
       %{buildroot}%{_mingw64_includedir}/%{pname}/s[^h]*.h
%endif

%if 0%{!?build_shared:1}
%files
%license COPYING
%doc ANALYSES AUTHORS BUGS DEVICES FAQ NEWS README
%{_mingw64_bindir}/ngspice.exe
%{_mingw64_mandir}/man1/ngspice.1%{?ext_man}
%dir %{_mingw64_datadir}/ngspice

%files scripts
%{_mingw64_datadir}/ngspice/scripts

%files doc
%doc ngspice-%{version}-manual.pdf

%files xspice-cm
%{_mingw64_bindir}/cmpp.exe
%{_mingw64_mandir}/man1/cmpp.1%{?ext_man}
%{_mingw64_libdir}/%{pname}

%files xspice-cm-devel
%doc Stuarts_Poly_Notes src/xspice/icm/README
%{_mingw64_includedir}/%{pname}
%{_mingw64_datadir}/%{pname}/dlmain.c

%else
%files -n mingw64-lib%{pname}%{so_ver}
%{_mingw64_bindir}/lib%{pname}*.dll

%files -n mingw64-lib%{pname}-devel
%dir %{_mingw64_includedir}/%{pname}
%{_mingw64_includedir}/%{pname}/sharedspice.h
%{_mingw64_libdir}/lib%{pname}.dll.a
%{_mingw64_libdir}/pkgconfig/%{pname}.pc
%endif

%changelog
openSUSE Build Service is sponsored by