%global octavedir %{_datadir}/octave/site/m/Csdp Name: csdp Version: 6.1.1 Release: 1%{?dist} Summary: C library for SemiDefinite Programming Group: Development/Libraries License: CPL URL: https://projects.coin-or.org/Csdp/ Source0: http://www.coin-or.org/download/source/Csdp/Csdp-%{version}.tgz # Written by Jerry James for Octave Source1: Csdp.INDEX # Man pages written by Jerry James with text borrowed freely from the sources. # These man pages therefore have the same copyright and license as the code. Source2: csdp.1 Source3: csdp-theta.1 Source4: csdp-graphtoprob.1 Source5: csdp-complement.1 Source6: csdp-rand_graph.1 BuildRequires: atlas-devel %description CSDP is a library of routines that implements a predictor corrector variant of the semidefinite programming algorithm of Helmberg, Rendl, Vanderbei, and Wolkowicz. The main advantages of this code are that it is written to be used as a callable subroutine, it is written in C for efficiency, the code runs in parallel on shared memory multiprocessor systems, and it makes effective use of sparsity in the constraint matrices. %package devel Summary: Header files for CSDP Group: Development/Libraries Requires: %{name}%{?_isa} = %{version}-%{release} %description devel This package contains the header files necessary to develop programs that use the CSDP library. %package tools Summary: Command line tools for working with CSDP Group: Applications/Engineering Requires: %{name}%{?_isa} = %{version}-%{release} %description tools This package contains command-line wrappers around the CSDP library, including a solver, a program for computing the Lovasz Theta number of a graph, and some graph manipulation programs. Note that "csdp-" has been prefixed to some of the binary names, due to the generic nature of the names. %package octave Summary: Octave interface to CSDP Group: Applications/Engineering Requires: %{name}-tools = %{version}-%{release}, octave BuildArch: noarch %description octave This package contains an Octave interface to the C library for SemiDefinite Programming. %prep %setup -q -n Csdp-%{version} %build # We can't use the shipped build system. First, a static library is built, # but we want a shared library. Second, parallel make is broken; there are no # explicit dependencies between subdirectories. Third, the CFLAGS need to be # altered in various more-or-less drastic ways. Fourth, the existing makefiles # link all binaries with the entire set of libs, but not all binaries need all # libs. We build by hand to contain the pain. # Choose the CFLAGS we want CFLAGS="${RPM_OPT_FLAGS} -I../include -DNOSHORTS -DUSESIGTERM -DUSEGETTIME -DUSEATLAS" if [ %{__isa_bits} = "64" ]; then CFLAGS+=" -DBIT64" fi sed -i -e "s|^CFLAGS=.*|CFLAGS=${CFLAGS}|" \ -e "s|^LIBS=.*|LIBS=-L../lib -L%{_libdir}/atlas -lsdp -llapack -lptf77blas -lptcblas -latlas -lm|" \ solver/Makefile theta/Makefile # Build the shared library cd lib gcc ${CFLAGS} -DUSEOPENMP -fopenmp -fPIC -shared -Wl,--soname=libsdp.so.6 *.c \ -o libsdp.so.%{version} -nodefaultlibs -L%{_libdir}/atlas -lgomp -llapack \ -latlas -lm -lc ln -s libsdp.so.%{version} libsdp.so.6 ln -s libsdp.so.6 libsdp.so # Build the solver cd ../solver make %{?_smp_mflags} # Build theta, but don't necessarily link with everything cd ../theta gcc $CFLAGS -c complement.c gcc $CFLAGS -o complement complement.o gcc $CFLAGS -c rand_graph.c gcc $CFLAGS -o rand_graph rand_graph.o make %{?_smp_mflags} %install # Install the library mkdir -p $RPM_BUILD_ROOT%{_libdir} cp -pP lib/libsdp* $RPM_BUILD_ROOT%{_libdir} # Install the binaries mkdir -p $RPM_BUILD_ROOT%{_bindir} cp -p solver/csdp $RPM_BUILD_ROOT%{_bindir} cp -p theta/theta $RPM_BUILD_ROOT%{_bindir}/csdp-theta cp -p theta/graphtoprob $RPM_BUILD_ROOT%{_bindir}/csdp-graphtoprob cp -p theta/complement $RPM_BUILD_ROOT%{_bindir}/csdp-complement cp -p theta/rand_graph $RPM_BUILD_ROOT%{_bindir}/csdp-rand_graph # Install the header files mkdir -p $RPM_BUILD_ROOT%{_includedir}/csdp cp -p include/*.h $RPM_BUILD_ROOT%{_includedir}/csdp # Install the Octave interface mkdir -p $RPM_BUILD_ROOT%{octavedir} cp -p matlab/*.m $RPM_BUILD_ROOT%{octavedir} cp -p %{SOURCE1} $RPM_BUILD_ROOT%{octavedir}/INDEX # Install the man pages mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1 cp -p %{SOURCE2} %{SOURCE3} %{SOURCE4} %{SOURCE5} %{SOURCE6} \ $RPM_BUILD_ROOT%{_mandir}/man1 %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %files %doc AUTHORS LICENSE doc/csdpuser.pdf %{_libdir}/libsdp.so.* %files devel %doc doc/example.c %{_libdir}/libsdp.so %{_includedir}/%{name} %files tools %doc theta/README %{_bindir}/* %{_mandir}/man1/* %files octave %doc matlab/README %{octavedir} %changelog * Fri Mar 18 2011 Jerry James <loganjerry@gmail.com> - 6.1.1-1 - Initial RPM