alpar@2237: #!/bin/bash
alpar@2237: 
alpar@2237: case $# in
alpar@2237:     1)
alpar@2237: 	RELEASE=1
alpar@2237: 	;;
alpar@2237:     2)
alpar@2237: 	RELEASE=$2
alpar@2237: 	;;
alpar@2237:     *)
alpar@2237: 	echo "Usage: rpmbuild-glpk tarfile [release]"
alpar@2237: 	;;	
alpar@2237: esac
alpar@2237: 
alpar@2237: 
alpar@2237: ORIGTAR=$1
alpar@2237: VERSION=`echo ${ORIGTAR/.tar.gz}|tr - ' '|awk '{print $(NF)}'`
alpar@2237: 
alpar@2237: echo "GLPK VERSION: $VERSION"
alpar@2237: echo "     RELEASE: $RELEASE"
alpar@2237: 
alpar@2237: 
alpar@2237: set -e
alpar@2237: 
alpar@2237: function make-dir () {
alpar@2237:     if [ ! -d $1 ]; then
alpar@2237: 	mkdir $1
alpar@2237:     fi
alpar@2237: }
alpar@2237: 
alpar@2237: rm -rf glpk-tmp
alpar@2237: make-dir glpk-tmp
alpar@2237: 
alpar@2237: cd glpk-tmp
alpar@2237: 
alpar@2237: tar xzf $ORIGTAR
alpar@2237: 
alpar@2237: echo 'Summary: GNU Linear Programming toolKit
alpar@2237: Name: glpk
alpar@2237: Version: '${VERSION}'
alpar@2237: Release: '${RELEASE}'
alpar@2237: License: GPL
alpar@2237: URL: http://www.gnu.org/software/glpk/glpk.html
alpar@2237: Source0: %{name}-%{version}.tar.gz
alpar@2237: Group: Development/Libraries
alpar@2237: BuildRoot: %{_tmppath}/%{name}-root
alpar@2237: Provides: glpk = '${VERSION}-${RELEASE}'
alpar@2237: Provides: glpk-devel = '${VERSION}-${RELEASE}'
alpar@2237: 
alpar@2237: %description
alpar@2237: The GLPK package is a set of routines written in ANSI C and organized
alpar@2237: in the form of a callable library. This package is intended for solving
alpar@2237: large-scale linear programming (LP), mixed integer linear programming
alpar@2237: (MIP), and other related problems.
alpar@2237: 
alpar@2237: The GLPK package includes the following main components:
alpar@2237: 
alpar@2237: * implementation of the simplex method;
alpar@2237: * implementation of the primal-dual interior-point method;
alpar@2237: * implementation of the branch-and-bound method;
alpar@2237: * application program interface (API);
alpar@2237: * GNU MathProg modeling language (a subset of AMPL);
alpar@2237: * GLPSOL, a stand-alone LP/MIP solver.
alpar@2237: 
alpar@2237: See GLPK webpage <http://www.gnu.org/software/glpk/glpk.html>.
alpar@2237: 
alpar@2237: %prep
alpar@2237: %setup -q
alpar@2237: 
alpar@2237: %build
alpar@2237: %configure
alpar@2237: make
alpar@2237: 
alpar@2237: %install
alpar@2237: rm -rf $RPM_BUILD_ROOT
alpar@2237: make DESTDIR=$RPM_BUILD_ROOT install
alpar@2237: 
alpar@2237: %clean
alpar@2237: rm -rf $RPM_BUILD_ROOT
alpar@2237: 
alpar@2237: %post -p /sbin/ldconfig
alpar@2237: 
alpar@2237: %postun -p /sbin/ldconfig
alpar@2237: 
alpar@2237: %files
alpar@2237: %defattr(-,root,root)
alpar@2237: %{_bindir}/glpsol
alpar@2237: %{_includedir}
alpar@2237: %{_libdir}/lib*
alpar@2237: %doc AUTHORS COPYING NEWS README
alpar@2237: '>glpk-${VERSION}/glpk.spec
alpar@2237: 
alpar@2237: tar czf glpk-${VERSION}.tar.gz glpk-${VERSION}
alpar@2237: rpmbuild -ta glpk-${VERSION}.tar.gz
alpar@2237: 
alpar@2237: cd ..
alpar@2237: rm -rf glpk-tmp