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