File ngspice.spec of Package ngspice

%define realname ngspice
%define realver  29
%define srcext   tar.gz

%define so_ver   0

# turn off the generation of debuginfo rpm  (RH9) ??
%global debug_package %{nil}

Name:          %{realname}
Version:       %{realver}
Release:       wiz%{?extraver:0.}1%{?dist}
License:       BSD-3-Clause and MIT and LGPL-2.0 and LGPL-2.1 and GPL-2.0+
Group:         Productivity/Scientific/Electronics
URL:           http://ngspice.sourceforge.net/
Summary:       General-purpose circuit simulation program for nonlinear and linear analyses

# Build-time parameters
BuildRequires: bison >= 2.7
BuildRequires: pkgconfig
BuildRequires: fftw3-devel
BuildRequires: readline-devel ncurses-devel
BuildRoot:     %{_tmppath}/%{name}-root
Source:        http://sourceforge.net/projects/ngspice/files/ng-spice-rework/%{realver}/%{realname}-%{realver}.%{srcext}

%description
Ngspice is a general-purpose circuit simulation program for nonlinear and linear
analyses. Circuits may contain resistors, capacitors, inductors, mutual
inductors, independent or dependent voltage and current sources, loss-less and
lossy transmission lines, switches, uniform distributed RC lines, and the five
most common semiconductor devices: diodes, BJTs, JFETs, MESFETs, and MOSFETs.

%package -n libngspice%{so_ver}
Group:         System/Libraries
Summary:       %{name} shared library
Provides:      libngspice = %{version}-%{release}
Obsoletes:     libngspice < %{version}-%{release}

%description -n libngspice%{so_ver}
Shared library for %{name}.

%package devel
Group:         Development/Libraries/C and C++
Summary:       Development stuff for %{name}
Requires:      libngspice%{so_ver} = %{version}-%{release}
Provides:      libngspice%{so_ver}-devel = %{version}-%{release}
Provides:      libngspice-devel = %{version}-%{release}

%description devel
Headers and libraries needed to build software against %{name}.

# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{version}

# Build step (compile/build binaries, documentation, etc)
%build
_CFLAGS='%{optflags} %{?gcc_lto}'
_LDFLAGS='-Wl,--as-needed -Wl,--strip-all %{?gcc_lto}'
%configure \
 --disable-debug \
 --enable-xspice \
 --enable-cider \
 --disable-static \
 --enable-openmp \
 --with-readline \
 --with-ngshared \
 CFLAGS="$_CFLAGS" \
 LDFLAGS="$_LDFLAGS"
%{__make} %{?_smp_mflags}

# Install built stuff
%install
%{__make} install DESTDIR=%{buildroot}

# Cleanup
%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}

# Files list
%files
%defattr(-,root,root)
%doc ANALYSES AUTHORS BUGS COPYING DEVICES FAQ NEWS
%doc README README.adms README.shared-xspice README.vdmos
%{_bindir}/cmpp
%{_datadir}/ngspice/
%doc %{_mandir}/man1/cmpp.1*
%exclude %{_mandir}/man1/ng*

%files -n libngspice%{so_ver}
%{_libdir}/libngspice.so.%{so_ver}*
%{_libdir}/ngspice/

%files devel
%defattr(-,root,root)
%{_includedir}/ngspice/
%{_libdir}/libngspice.so
%{_libdir}/pkgconfig/ngspice.pc
%exclude %{_libdir}/libngspice.la

%post   -n libngspice%{so_ver} -p /sbin/ldconfig
%postun -n libngspice%{so_ver} -p /sbin/ldconfig

%changelog
openSUSE Build Service is sponsored by