| [2237] | 1 | #!/bin/bash | 
|---|
|  | 2 |  | 
|---|
|  | 3 | case $# in | 
|---|
|  | 4 | 1) | 
|---|
|  | 5 | RELEASE=1 | 
|---|
|  | 6 | ;; | 
|---|
|  | 7 | 2) | 
|---|
|  | 8 | RELEASE=$2 | 
|---|
|  | 9 | ;; | 
|---|
|  | 10 | *) | 
|---|
|  | 11 | echo "Usage: rpmbuild-glpk tarfile [release]" | 
|---|
|  | 12 | ;; | 
|---|
|  | 13 | esac | 
|---|
|  | 14 |  | 
|---|
|  | 15 |  | 
|---|
|  | 16 | ORIGTAR=$1 | 
|---|
|  | 17 | VERSION=`echo ${ORIGTAR/.tar.gz}|tr - ' '|awk '{print $(NF)}'` | 
|---|
|  | 18 |  | 
|---|
|  | 19 | echo "GLPK VERSION: $VERSION" | 
|---|
|  | 20 | echo "     RELEASE: $RELEASE" | 
|---|
|  | 21 |  | 
|---|
|  | 22 |  | 
|---|
|  | 23 | set -e | 
|---|
|  | 24 |  | 
|---|
|  | 25 | function make-dir () { | 
|---|
|  | 26 | if [ ! -d $1 ]; then | 
|---|
|  | 27 | mkdir $1 | 
|---|
|  | 28 | fi | 
|---|
|  | 29 | } | 
|---|
|  | 30 |  | 
|---|
|  | 31 | rm -rf glpk-tmp | 
|---|
|  | 32 | make-dir glpk-tmp | 
|---|
|  | 33 |  | 
|---|
|  | 34 | cd glpk-tmp | 
|---|
|  | 35 |  | 
|---|
|  | 36 | tar xzf $ORIGTAR | 
|---|
|  | 37 |  | 
|---|
|  | 38 | echo 'Summary: GNU Linear Programming toolKit | 
|---|
|  | 39 | Name: glpk | 
|---|
|  | 40 | Version: '${VERSION}' | 
|---|
|  | 41 | Release: '${RELEASE}' | 
|---|
|  | 42 | License: GPL | 
|---|
|  | 43 | URL: http://www.gnu.org/software/glpk/glpk.html | 
|---|
|  | 44 | Source0: %{name}-%{version}.tar.gz | 
|---|
|  | 45 | Group: Development/Libraries | 
|---|
|  | 46 | BuildRoot: %{_tmppath}/%{name}-root | 
|---|
|  | 47 | Provides: glpk = '${VERSION}-${RELEASE}' | 
|---|
|  | 48 | Provides: glpk-devel = '${VERSION}-${RELEASE}' | 
|---|
|  | 49 |  | 
|---|
|  | 50 | %description | 
|---|
|  | 51 | The GLPK package is a set of routines written in ANSI C and organized | 
|---|
|  | 52 | in the form of a callable library. This package is intended for solving | 
|---|
|  | 53 | large-scale linear programming (LP), mixed integer linear programming | 
|---|
|  | 54 | (MIP), and other related problems. | 
|---|
|  | 55 |  | 
|---|
|  | 56 | The GLPK package includes the following main components: | 
|---|
|  | 57 |  | 
|---|
|  | 58 | * implementation of the simplex method; | 
|---|
|  | 59 | * implementation of the primal-dual interior-point method; | 
|---|
|  | 60 | * implementation of the branch-and-bound method; | 
|---|
|  | 61 | * application program interface (API); | 
|---|
|  | 62 | * GNU MathProg modeling language (a subset of AMPL); | 
|---|
|  | 63 | * GLPSOL, a stand-alone LP/MIP solver. | 
|---|
|  | 64 |  | 
|---|
|  | 65 | See GLPK webpage <http://www.gnu.org/software/glpk/glpk.html>. | 
|---|
|  | 66 |  | 
|---|
|  | 67 | %prep | 
|---|
|  | 68 | %setup -q | 
|---|
|  | 69 |  | 
|---|
|  | 70 | %build | 
|---|
|  | 71 | %configure | 
|---|
|  | 72 | make | 
|---|
|  | 73 |  | 
|---|
|  | 74 | %install | 
|---|
|  | 75 | rm -rf $RPM_BUILD_ROOT | 
|---|
|  | 76 | make DESTDIR=$RPM_BUILD_ROOT install | 
|---|
|  | 77 |  | 
|---|
|  | 78 | %clean | 
|---|
|  | 79 | rm -rf $RPM_BUILD_ROOT | 
|---|
|  | 80 |  | 
|---|
|  | 81 | %post -p /sbin/ldconfig | 
|---|
|  | 82 |  | 
|---|
|  | 83 | %postun -p /sbin/ldconfig | 
|---|
|  | 84 |  | 
|---|
|  | 85 | %files | 
|---|
|  | 86 | %defattr(-,root,root) | 
|---|
|  | 87 | %{_bindir}/glpsol | 
|---|
|  | 88 | %{_bindir}/tspsol | 
|---|
|  | 89 | %{_includedir} | 
|---|
|  | 90 | %{_libdir}/lib* | 
|---|
|  | 91 | %doc AUTHORS COPYING NEWS README | 
|---|
|  | 92 | '>glpk-${VERSION}/glpk.spec | 
|---|
|  | 93 |  | 
|---|
|  | 94 | tar czf glpk-${VERSION}.tar.gz glpk-${VERSION} | 
|---|
|  | 95 | rpmbuild -ta glpk-${VERSION}.tar.gz | 
|---|
|  | 96 |  | 
|---|
|  | 97 | cd .. | 
|---|
|  | 98 | rm -rf glpk-tmp | 
|---|