Sophie

Sophie

distrib > Mandriva > 2010.2 > x86_64 > by-pkgid > ac18ea25c3293a56498ac0918b84b162 > files > 10

singular-3.1.0-14mdv2010.1.src.rpm

%define		name		singular
%define		devname		%mklibname %{name} -d
%define		staticname	%mklibname %{name} -d -s
%define		singulardir	%{_datadir}/singular

Name:		%{name}
Summary:	Computer Algebra System for polynomial computations
Version:	3.1.0
Release:	%mkrel 14
License:	GPL
Group:		Sciences/Mathematics
Source0:	http://www.mathematik.uni-kl.de/ftp/pub/Math/Singular/SOURCES/3-1-0/Singular-3-1-0-4.tar.gz
Source1:	http://www.mathematik.uni-kl.de/ftp/pub/Math/Singular/Factory/factory-3-1-0.tar.gz
Source2:	http://www.mathematik.uni-kl.de/ftp/pub/Math/Singular/Factory/factory-doc.tar.gz
Source3:	http://www.mathematik.uni-kl.de/ftp/pub/Math/Singular/Libfac/libfac-3-1-0.tar.gz
Source4:	fix-singular-includes.pl
Source5:	singular.hlp
Source6:	singular.idx
URL:		http://www.singular.uni-kl.de/

BuildRequires:	libgmp-devel ntl-devel flex libncurses-devel readline-devel
Requires:	surf

BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-buildroot

Patch0:		Singular-3-1-0-4-sagemath.patch
Patch1:		Singular-3-1-0-4-const-char.patch

%description
SINGULAR is a Computer Algebra system for polynomial computations with
special emphasize on the needs of commutative algebra, algebraic
geometry, singularity theory and polynomial system solving. For a more
detailed overview of SINGULAR, see
     http://www.singular.uni-kl.de/Overview/

%package	-n %{devname}
Group:		Development/Other
Summary:	Singular development files
Obsoletes:	%{name}-devel < 3.0.4-2
Provides:	%{name}-devel = %{version}-%{release}

%description	-n %{devname}
This package contains the Singular development files.

%package	-n %{staticname}
Group:		Development/Other
Summary:	Singular static libraries
Provides:	%{name}-static-devel = %{version}-%{release}
Requires:	%{name}-devel = %{version}-%{release}

%description	-n %{staticname}
This package contains the Singular static libraries.

%prep
%setup -q -n Singular-3-1-0 -a1 -a2 -a3

%patch0 -p1
%patch1 -p1

%build
find . -type d -name CVS -exec rm -fr {} \; 2> /dev/null || :

#   There is no way, other then patching all Makefiles.in by hand
# to make it respect DESTDIR ..., so build it pretending %{buildroot}
# is part of prefix, and correct the few wrong usages later.
#   It should be possible to build with proper --prefix, and use
# the install-sharedist target, but it will fail before, when trying
# to create directories in %{_prefix} during build.
export CXXFLAGS="%{optflags} -fPIC"
export CFLAGS="%{optflags} -fPIC"

# Should be possible to build with s/--without-MP/--enable-MP/
# but MP configure fails due to sizeof(long) != 4 on x86_64
./configure						\
	--prefix=%{buildroot}%{_prefix}			\
	--exec-prefix=%{buildroot}%{_prefix}		\
	--includedir=%{buildroot}%{_includedir}		\
	--libdir=%{buildroot}%{_libdir}			\
	--with-malloc=system				\
	--with-apint=gmp				\
	--with-gmp=%{_prefix}				\
	--with-ntl=%{_prefix}				\
	--disable-NTL					\
	--without-MP					\
	--without-lex					\
	--without-bison					\
	--without-Boost					\
	--enable-factory				\
	--enable-libfac					\
	--enable-Singular				\
	--enable-IntegerProgramming			\
	--enable-Plural					\
	--enable-Texinfo				\
	--enable-Texi2html				\
	--enable-doc					\
	--enable-emacs
# --enable-sgroup
#	needs sgroup directory (tarball where?)

perl -pi					\
	-e 's|(#define\s+HAVE_BOOST)|//$1|g;'	\
	`find . -name \*.h`

make

# need MP to build doc or will lock on failed tcp connection
#pushd doc
#    make SINGULAR=%{buildroot}%{singulardir}/%{arch}/Singular-3-1-0 all
#popd

perl -pi					\
	-e 's|%{buildroot}||g;'			\
	-e 's|--with-external-config[^ ]+||g;'	\
	-e "s|\s*--cache-file[^']+||;"		\
	-e 's|in %{builddir}[^"]+||g;'		\
    kernel/mod2.h				\
    Singular/mod2.h				\
    factory/factoryconf.h			\
    factory/config.h

# correct compilation by default without exceptions,
# but including c++ headers that generate exceptions
# (/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp)
perl -i						\
	-e 's|--no-exceptions|-fexceptions|g;'	\
    `find . -name configure\*`

# these are not rebuilt after updating headers
rm -f Singular/Singular %{buildroot}%{_prefix}/Singular-3-1-0
# run make once more to recompile anything dependent on the patched headers.
make all libsingular

%install
%makeinstall_std install-libsingular

pushd %{buildroot}%{_prefix}
  pushd %{_lib}
    # these files are installed twice, due to the buildroot as prefix
    # in configure, as it wants to install files during normal build...
    rm -f dbmsr.so mpsr.so p_Procs_FieldGeneral.so	\
	p_Procs_FieldIndep.so p_Procs_FieldQ.so p_Procs_FieldZp.so
  popd
  mkdir -p %{buildroot}%{singulardir}/%{_arch}
  mv -f						\
	change_cost ESingular gen_test libparse	\
	LLL Singular-3-1-0 solve_IP		\
	surfex toric_ideal TSingular		\
	*.so %{_lib}/*.o			\
	%{buildroot}%{singulardir}/%{_arch}
  rm -f LIB Singular

  pushd %{buildroot}%{_includedir}
    [ -d %{name} ] || mkdir %{name}
    mv -f *.c *.h templates %{name}
  popd
popd

mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{singulardir}/LIB/gftables
cp -fa Singular/LIB/*.lib %{buildroot}%{singulardir}/LIB
cp -far Singular/LIB/gftables/* %{buildroot}%{singulardir}/LIB/gftables
cp -fa Singular/LIB/surfex/surfex.jar %{buildroot}%{singulardir}/LIB
mkdir -p %{buildroot}%{_bindir}
cat > %{buildroot}%{_bindir}/Singular << EOF
#!/bin/sh

SINGULARPATH=%{singulardir}/LIB %{singulardir}/%{_arch}/Singular-3-1-0 \$*
EOF
chmod +x %{buildroot}%{_bindir}/Singular
ln -sf %{_bindir}/Singular %{buildroot}%{_bindir}/singular

perl -pi -e								\
	's|(java -jar) (surfex.jar)|$1 %{singulardir}/LIB/$2|;'		\
	%{buildroot}%{singulardir}/LIB/surfex

# these headers are included by installed ones, but not installed...
mkdir -p %{buildroot}%{_includedir}/%{name}/Singular
cp -fa Singular/*.h %{buildroot}%{_includedir}/%{name}/Singular

# correct includes
perl %{SOURCE4}

# keep only libsingular.h outside %{_includedir}/%{name}
mv %{buildroot}%{_includedir}/%{name}/libsingular.h %{buildroot}%{_includedir}
# files required during sagemath build, and/or side effect of sagemath patch
cp kernel/kInline.cc %{buildroot}%{_includedir}/%{name}
cp Singular/{attrib,grammar,ipid,ipshell,lists,subexpr,tok}.h  %{buildroot}%{_includedir}/%{name}

# installed headers are only readable by file owner...
chmod -R a+r %{buildroot}
find %{buildroot}%{_includedir} -type f -exec chmod a-x {} \;

# move conflicting static files to archdir
mv -f %{buildroot}%{_libdir}/*.a %{buildroot}%{singulardir}/%{_arch}

cp %{SOURCE5} %{SOURCE6} %{buildroot}%{singulardir}

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root)
%{_bindir}/Singular
%{_bindir}/singular
%dir %{singulardir}
%dir %{singulardir}/%{_arch}
%{singulardir}/%{_arch}/ESingular
%{singulardir}/%{_arch}/LLL
%{singulardir}/%{_arch}/Singular-3-1-0
%{singulardir}/%{_arch}/TSingular
%{singulardir}/%{_arch}/change_cost
%{singulardir}/%{_arch}/gen_test
%{singulardir}/%{_arch}/libparse
%{singulardir}/%{_arch}/solve_IP
%{singulardir}/%{_arch}/surfex
%{singulardir}/%{_arch}/toric_ideal
%{singulardir}/LIB
%{singulardir}/singular.*

%files		-n %{devname}
%defattr(-,root,root)
%{singulardir}/%{_arch}/*.so
%dir %{_includedir}/%{name}
%{_includedir}/%{name}/*
%{_includedir}/*.h
%{_libdir}/*.so

%files		-n %{staticname}
%defattr(-,root,root)
%{singulardir}/%{_arch}/*.o
%{singulardir}/%{_arch}/*.a


%changelog
* Thu Feb 11 2010 Paulo Andrade <pcpa@mandriva.com.br> 3.1.0-14mdv2010.1
+ Revision: 504285
- Update for build of sagemath 4.3.2

* Wed Feb 10 2010 Funda Wang <fwang@mandriva.org> 3.1.0-13mdv2010.1
+ Revision: 503620
- rebuild for new gmp

* Tue Nov 17 2009 Paulo Andrade <pcpa@mandriva.com.br> 3.1.0-9mdv2010.1
+ Revision: 467051
- Add documentation files and correct sage 4.2 crash

* Tue Nov 17 2009 Paulo Andrade <pcpa@mandriva.com.br> 3.1.0-8mdv2010.1
+ Revision: 466703
- Update for sage 4.2 build.

* Thu Sep 10 2009 Paulo Andrade <pcpa@mandriva.com.br> 3.1.0-7mdv2010.0
+ Revision: 436224
- disable build of alternate libntl

* Fri Sep 04 2009 Paulo Andrade <pcpa@mandriva.com.br> 3.1.0-6mdv2010.0
+ Revision: 431798
- Add minor patch to match sagemath doctest expected results
- add a lowercase symlink to /usr/bin/Singular

* Mon Aug 31 2009 Paulo Andrade <pcpa@mandriva.com.br> 3.1.0-5mdv2010.0
+ Revision: 423079
- Install .a libraries in the singular archdir, to avoid conflicts with ntl.

* Thu Aug 13 2009 Paulo Andrade <pcpa@mandriva.com.br> 3.1.0-3mdv2010.0
+ Revision: 416218
- Correct Singular shell script to actually pass command line arguments
- Install surfex.jar and patch surfex to find it

* Wed Jul 15 2009 Paulo Andrade <pcpa@mandriva.com.br> 3.1.0-1mdv2010.0
+ Revision: 396445
- Update to latest upstream release version 3.1.0, patchlevel 4.

* Fri May 29 2009 Paulo Andrade <pcpa@mandriva.com.br> 3.0.4-7mdv2010.0
+ Revision: 381167
- Correct memory corruptions problems in sagemath, that had it's root
  cause in the singular package.

* Thu Apr 23 2009 Paulo Andrade <pcpa@mandriva.com.br> 3.0.4-4mdv2009.1
+ Revision: 368954
- Install .lib files, as the Singular binary wants to read them.

* Thu Apr 16 2009 Paulo Andrade <pcpa@mandriva.com.br> 3.0.4-3mdv2009.1
+ Revision: 367788
- Correct include path to work from %%{_includedir}, and "manually" install
  headers that are required by the ones that are installed by %%makeinstall_std.

* Tue Apr 07 2009 Paulo Andrade <pcpa@mandriva.com.br> 3.0.4-2mdv2009.1
+ Revision: 365063
- o Compile C and C++ source with -fPIC to avoid x86_64 link problems.
  o Explicitly disable detection of libboost, as it generates link errors.
- o Renames singular-devel to libsingular-devel and add libsingular-static-devel.
  o Add missing files due to not executing 'make install-libsingular' target.

* Tue Mar 03 2009 Paulo Andrade <pcpa@mandriva.com.br> 3.0.4-1mdv2009.1
+ Revision: 348176
- Module MP wants sizeof(long) == 4. Disable build on x86_64.
- Initial import of singular, version 3.0.4.
  Singular is a Computer Algebra System for polynomial computations.
- singular