%global pkgvers 0 %global scdate0 20230527 %global schash0 fd24e5af7e3cbc7ffed487b98739f5f94d63481d %global branch0 master %global source0 https://git.code.sf.net/p/ngspice/ngspice.git %global scdate1 20230522 %global schash1 d88c4d1d9b7bf3ae8c299b00649994cd202a55f2 %global branch1 master %global source1 https://git.code.sf.net/p/ngspice/ngspice-manuals.git %global sshort0 %{expand:%%{lua:print(('%{schash0}'):sub(1,8))}} %define with_docs 1 %if 0%{?rhel} == 9 %define with_docs 0 %endif Name: ngspice Version: 40 Release: %{scdate0}.%{pkgvers}.git%{sshort0}%{?dist} Summary: A mixed level/signal circuit simulator License: BSD URL: http://ngspice.sourceforge.net Patch0: ngspice-26-blt-linkage-workaround.patch Patch1: ngspice-blt.patch BuildRequires: git make gcc gcc-c++ automake libtool bison byacc flex p7zip BuildRequires: readline-devel libXext-devel libpng-devel libICE-devel libXaw-devel BuildRequires: freetype-devel libXft-devel libXrender-devel libGL-devel libXt-devel BuildRequires: fontconfig-devel ImageMagick fftw3-devel mot-adms Requires: ngspice-manual Provides: ngspice-doc = %{version}-%{release} %description Ngspice is a general-purpose circuit simulator program. %package -n tclspice Summary: Tcl/Tk interface for ngspice BuildRequires: tk-devel blt-devel %description -n tclspice TclSpice is an improved version of Berkeley Spice designed to be used with the Tcl/Tk scripting language. The project is based upon the NG-Spice source code base with many improvements. %package -n libngspice Summary: Shared library version of ngspice %description -n libngspice This package contains shared library version of ngspice. %package -n libngspice-devel Summary: Development files for libngspice Requires: libngspice%{?isa} = %{version}-%{release} %description -n libngspice-devel This package contains libraries and header files for developing applications that use libngspice. %if %{with_docs} %package -n ngspice-manual Summary: NGSpice manual BuildRequires: python3 qt5-qtsvg lyx %if 0%{?fedora} BuildRequires: texlive-units %endif %description -n ngspice-manual PDF manual for ngspice. %endif %prep %setup -T -c -n %{name} rm -rf %{_builddir}/%{name}/* git clone --depth 1 -n -b %{branch0} %{source0} . git fetch --depth 1 origin %{schash0} git reset --hard %{schash0} git log --format=fuller %if %{with_docs} git clone --depth 1 -n -b %{branch1} %{source1} manuals git -C manuals fetch --depth 1 origin %{schash1} git -C manuals reset --hard %{schash1} git -C manuals log --format=fuller %endif %patch0 -p1 -b .link %patch1 -p1 -b .blt %build # make sure the examples are UTF-8 for nonUTF8 in \ examples/tclspice/tcl-testbench4/selectfromlist.tcl \ examples/tclspice/tcl-testbench1/testCapa.cir \ examples/tclspice/tcl-testbench1/capa.cir \ ChangeLog \ %{nil} do %{_bindir}/iconv -f ISO-8859-1 -t utf-8 $nonUTF8 > $nonUTF8.conv %{__mv} -f $nonUTF8.conv $nonUTF8 done # rpmlint warnings find examples/ -type f -name ".cvsignore" -exec rm -rf {} ';' find src/ -type f -name "*.c" -exec chmod -x {} ';' find src/ -type f -name "*.h" -exec chmod -x {} ';' find src/ -type f -name "*.l" -exec chmod -x {} ';' find src/ -type f -name "*.y" -exec chmod -x {} ';' # Fix Tclspice's examples sed -i \ 's|load "../../../src/.libs/libspice.so"|lappend auto_path "%{_libdir}/tclspice"\npackage require spice|' \ examples/tclspice/*/*.{tcl,sh} sed -i \ 's|load ../../../src/.libs/libspice.so|lappend auto_path "%{_libdir}/tclspice"\npackage require spice|' \ examples/tclspice/*/*.{tcl,sh} sed -i \ 's|spice::codemodel ../../src/xspice/icm/spice2poly|spice::codemodel %{_libdir}/tclspice/spice2poly|' \ examples/tclspice/tcl-testbench*/tcl-testbench*.sh # Fixed minor build sed -i \ "s|AM_CPPFLAGS =|AM_CPPFLAGS = -I\$(top_srcdir)/src/maths/ni |" \ src/spicelib/analysis/Makefile.am sed -i 's|BLT BLT24 BLT25|Blt30|g' configure.ac* %global optflags %(echo %{optflags} | sed 's|-Werror=format-security||') export ACLOCAL_FLAGS=-Im4 ./autogen.sh --adms chmod +x configure %if %{with_docs} # ---- Manuals ---------------------------------------------------------------- pushd manuals autoreconf -f %configure %if 0%{?fedora} make %endif popd %endif # ---- Tclspice ---------------------------------------------------------------- # Adding BLT support export CFLAGS="%{optflags} -I%{_includedir}/blt" # Make builddir for tclspice %{__mkdir} -p tclspice %{__cp} -Rl `ls . | grep -v tclspice` tclspice # Configure tclspice pushd tclspice sed -i \ 's|\#define NGSPICEDATADIR "\`echo \$dprefix/share/ngspice\`"|\#define NGSPICEDATADIR "\`echo %{_libdir}/tclspice\`"|' \ configure* # direct access to Tcl_Interp->result deprecated in tcl8.6, # remaining usage cannot be replaced by Tcl_SetResult export CPPFLAGS=-DUSE_INTERP_RESULT %configure \ --disable-silent-rules \ --enable-adms \ --enable-xspice \ --enable-maintainer-mode \ --enable-dependency-tracking \ --enable-cider \ --enable-osdi \ %if 0 --enable-newpred \ %endif --enable-openmp \ --enable-predictor \ --enable-shared \ --with-readline=yes \ --with-tcl=%{_libdir}/ \ --libdir=%{_libdir}/tclspice \ %{nil} %{__make} %{?_smp_mflags} # Once install to the temp dir rm -rf $(pwd)/../INST-TCLSPICE %{__make} INSTALL="install -p" install DESTDIR=$(pwd)/../INST-TCLSPICE popd # ------------------------------------------------------------------------------ for opt in SHARED NOSHARED do SHARED_OPT="" if test x$opt == xSHARED then SHARED_OPT="$SHARED_OPT --with-ngshared" # bug 1927628 SHARED_OPT="$SHARED_OPT --with-readline=no" else SHARED_OPT="$SHARED_OPT --without-ngshared" SHARED_OPT="$SHARED_OPT --with-readline=yes" fi %configure \ --disable-silent-rules \ ${SHARED_OPT} \ --enable-adms \ --enable-xspice \ --enable-maintainer-mode \ --enable-dependency-tracking \ --enable-cider \ --enable-osdi \ %if 0 # bug 844100, bug 1429130 --enable-newpred \ %endif --enable-openmp \ --enable-predictor \ --enable-shared \ --libdir=%{_libdir} \ %{nil} %{__make} clean # No parallel make %{__make} %{?_smp_mflags} # Once install to the temp dir rm -rf $(pwd)/INST-NGSPICE-${opt} %{__make} INSTALL="install -p" install DESTDIR=$(pwd)/INST-NGSPICE-${opt} find $(pwd)/INST-NGSPICE-${opt} -type f | sort done %install # ---- Tclspice ---------------------------------------------------------------- # Clean up unneeded / duplicate files also installed from ngspice pushd INST-TCLSPICE rm -rf ./%{_datadir}/ngspice/include/ # see bug 1311869 rm -f ./%{_datadir}/ngspice/scripts/spinit # binary differ # for --short-circuit if [ -f .%{_bindir}/cmpp ] ; then mv .%{_bindir}/cmpp{,-tclspice} fi popd # Install # ref: https://sourceforge.net/p/ngspice/support-requests/34/ # For codemodel files, install non-shared version # so, first, install ngshared version, then non-shared version for opt in SHARED NOSHARED do cp -a INST-NGSPICE-${opt}/* %{buildroot} done cp -a INST-TCLSPICE/* %{buildroot} %{__rm} -rf \ %{buildroot}%{_libdir}/tclspice/libspice.la \ %{buildroot}%{_libdir}/tclspice/libspicelite.la \ %{buildroot}%{_libdir}/libngspice.la \ %{buildroot}%{_includedir}/config.h \ %{nil} # ------------------------------------------------------------------------------ # Ensuring that all docs are under %%{_pkgdocdir} mkdir -p %{buildroot}%{_pkgdocdir} cp -pr examples/ %{buildroot}%{_pkgdocdir} %if %{with_docs} %if 0%{?fedora} install -cpm 0644 manuals/build_pdf/manual.pdf %{buildroot}%{_pkgdocdir}/%{name}-%{version}.pdf %endif %endif cp -a \ Stuarts_Poly_Notes \ FAQ \ DEVICES \ ANALYSES \ %{buildroot}%{_pkgdocdir} cp -a \ AUTHORS \ README* \ BUGS \ ChangeLog \ NEWS \ %{buildroot}%{_pkgdocdir} # pull as debuginfo chmod +x %{buildroot}%{_libdir}/ngspice/*.cm chmod +x %{buildroot}%{_libdir}/tclspice/ngspice/*.cm %check pushd tests # See https://sourceforge.net/p/ngspice/bugs/544/ rm -rf USERPROFILE mkdir USERPROFILE echo "set ngbehavior=mc" > USERPROFILE/spice.rc export USERPROFILE=$(pwd)/USERPROFILE make check popd %files %doc %{_pkgdocdir} %if 0%{?fedora} %exclude %{_pkgdocdir}/%{name}-%{version}.pdf %endif %license COPYING %{_bindir}/* %{_datadir}/%{name}/ %exclude %{_datadir}/%{name}/scripts/tclspinit %{_libdir}/ngspice/ %{_mandir}/man1/* %exclude %{_pkgdocdir}/examples/tclspice %files -n tclspice %doc %{_pkgdocdir}/examples/tclspice %{_libdir}/tclspice/ %dir %{_datadir}/ngspice %dir %{_datadir}/%{name}/scripts/ %{_datadir}/%{name}/scripts/tclspinit %files -n libngspice %{_libdir}/libngspice.so.0* %files -n libngspice-devel %{_libdir}/pkgconfig/ngspice.pc %{_libdir}/libngspice.so %{_includedir}/ngspice/ %if %{with_docs} %if 0%{?fedora} %files -n ngspice-manual %doc %{_pkgdocdir}/%{name}-%{version}.pdf %endif %endif %changelog * Mon Jan 24 2022 Balint Cristian - git update releases * Fri Dec 31 2021 Mamoru TASAKA - 36-1 - Update to 36