Jim Langston's Weblog

http://blogs.sun.com/langston/date/20090630 Tuesday June 30, 2009

Getting GLPK into opensolaris repository /contrib

Getting GNU Linear Programming Kit (GLPK) into the OpenSolaris /contrib repository


OpenSolaris is a very, very robust operating system and now that /contrib is open for putting open source applications into its balliwick, I want to show how easy it is to get those highly productive open source application into it.

How I started

  • GLPK 4.38 (or the latest version)

  • OpenSolaris 2008.11, shortly to be a later version

  • SUNWbinutils

  • Studio compilers (the version which can be downloaded from the repository)

http://www.gnu.org/software/glpk/glpk.html is the link to GLPK. This is where I started to look at GLPK, pulling the source code from there.

I currently have 2 test development environments, the first contains the latest version of OpenSolaris. The other is the same as the /contrib environment, which is 2008.11. I have 2008.11 because I know that when I push something to /contrib, it will need to be built in the environment, which /contrib gets updated, I will recheck all my work and re-submit if necessary.


Building 32bit GLPK


# gzip -d glpk-4.38.tar.gz

# tar xvf glpk-4.38.tar

# ./configure --prefix=/usr/glpk CC=/opt/SunStudioExpress/bin/cc CFLAGS=-xO4 --with-gnu-ld --enable-shared

# gmake

# gmake install

A 32bit version of GLPK should be installed in /usr/glpk, this allowed me to test to make sure my build of GLPK was good, there are a bunch of examples files to run with the source


Building 64bit GLPK


# ./configure --prefix=/usr/glpk/amd64 CC=/opt/SunStudioExpress/bin/cc CFLAGS="-xO4 -xtarget=opteron -xarch=amd64" --with-gnu-ld --enable-shared

# gmake

# gmake install

A 64bit version of GLPK should be installed in /usr/glpk/amd64, this allowed me to test to make sure my build of GLPK was good, there are a bunch of examples files to run with the source


All done with testing, GLPK looks good both 64bit and 32bit, now to get ready to put into the repository


Creating the spec file


This is the spec file that I have created for building on OpenSolaris.org for submission to /contrib. the file is named, glpk.spec


#
# spec file for package: glpk
#
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#

%include Solaris.inc

Name: glpk
Summary: GNU Linear Programming Kit
Version: 4.38
License: GPLv3
Source: ftp://ftp.gnu.org/gnu/glpk/%{name}-%{version}.tar.gz
URL: http://www.gnu.org/software/glpk/
Group: HPC
Distribution: OpenSolaris
Vendor: GNU Community
%include default-depend.inc

BuildRoot: %{_tmppath}/%{name}-%{version}-build
SUNW_Basedir: /usr
SUNW_Copyright: %{name}.copyright

# OpenSolaris IPS Manifest Fields
Meta(info.maintainer): jim.langston@sun.com
Meta(info.repository_url): http://www.gnu.org/software/glpk

%description
The GLPK (GNU Linear Programming Kit) package is intended for solving large-scale linear programming (LP), mixed integer programming (MIP), and other related problems. It is a set of routines written in ANSI C and organized in the form of a callable library.

%prep
%setup -c -q -T -b 0 -n %{name}

%build
#
# Build GLPK
#

cd %{name}-%{version}
./configure --prefix=%{_basedir}/%{name} CFLAGS="-xO4" --enable-shared
gmake
gmake install DESTDIR=$RPM_BUILD_ROOT

#
# 32bit version installed, clean up, preparing to build 64bit
#
gmake distclean

#
# Make 64bit version
#
./configure --prefix=%{_basedir}/%{name}/amd64 CFLAGS="-xO4 -xtarget=opteron -xarch=amd64" --enable-shared
gmake

%install
#
# This will install 64bit version
#
cd %{name}-%{version}
gmake install DESTDIR=$RPM_BUILD_ROOT

%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr (-, root, other)
%dir %attr (0755, root, sys) %{_basedir}/%{name}
%{_basedir}/%{name}/*

%changelog
* Wed Jun 24 2009 - jim.langston@sun.com
* Thur Jun 25 2009 Jim Langston

Will install 64bit and 32bit versions
* Thur Jun 26 2009 Jim Langston

Changed CFLAGS to compile 64bit on Studio 11
* Wed Jul 1 2009 Jim Langston

Changed basedir to /usr


Submitting to /contrib


There are now two steps left to get GLPK into the repository, From the submission screen, I needed to included the glpk.spec file, and also, I needed to include the copyright file that is included with the source named, COPYING. I copied this file to one called glpk.copyright, which is what I am looking for in the glpk.spec file via the variable SUNW_copyright.

With these two pieces in place, the submission is then in the hands of opensolaris.org to validate. Once the validation is complete, then the source is built, and any errors, of which I had a few initially, are logged, or if the build passes, a log is generated and also the ability to download and check the IPS is created in /pending.

Once others have had a chance to check out GLPK, it will be voted on to move to /contrib.

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed