Abhishek Gupta

The Sun won’t set at NIT Durgapur !

Posts Tagged ‘build’

Finally some success porting OpenVPN

Posted by abhiitechie on May 15, 2009

Today has been quite  eventfull and productive for me . I finally found some success with my project . I am trying to port a software called OpenVPN .OpenVPN is a full-featured open source SSL VPN solution that accommodates a wide range of configurations, including remote access, site-to-site VPNs, Wi-Fi security, and enterprise-scale remote access solutions with load balancing, failover, and fine-grained access-control.

When I tried to build it from source I faced some difficulties getting the configure run. After a bit of research I got that working with the –disable lzo option . So this was the first dependency resolved for me . Then on doing make there was error compiling a file called tun.c . Researched again and found that for a 64 bit platform like open solaris I need to have the tun kernel module to compile the file tun.c and that to I had to make some changes inside the Makefile.in of the tun source adding the option -m64 for the 64 bit open solaris

Then I faced the error gcc not found while building the package tun 1.1 . As we kno gcc is not present by default in a Solaris system and is taken care of by Sun Studio compilers but the package in hand was hellbent on a gcc . So what I did is I again edited the file Makefile.in and replaced the CC entry with cc instead of gcc . Then it showed -Wall is an illegal option with cc so without thinking much I just removed it and crossed my fingers while making it and finally the tunnel driver was successfully installed and with the tunnel driver in the environment the dependencies of OpenVPN was also resolved .

Now it was the time for me making the Spec file from scratch for the OpenVPN source package. The preamble section was done easily without much trouble . Then I wrote the %prep section and kept it simple . Then there was the tough task of writing the %build section and I included all the dependency option of configure and with the help of someone in the mailing list I was able to write the %build section

%install was straight forward without any complicacies .

%file was the best . After lots of asking , mailing , head-scratching and research even that was done .

I kept my fingers crossed and executed pkgtool on the spec I wrote and guess what it passed .

Submitted my passed to the Source juicer site for the final test . It is still waiting to get validated may be by tommorow I will be able to see the results .

One important thing to be noted is that before submitting the spec to the juicer the license , vendor and copyright directives must be included as it is checked for also the .copyright file need to be uploaded along with the .spec file to the juicer . So the syntax check was done and it said OK .

Here is the spec I wrote :#OpenVPN (TM) — An Open Source VPN daemon

#Copyright (C) 2002-2008 OpenVPN Technologies, Inc.

%include Solaris.inc

Name:                openvpn
Summary:             OpenVPN is a full-featured open source SSL VPN solution.
Version:             2.0.9
License:             GPL license version 2
Group:               SSL VPN
Vendor:             OpenVPN
URL:                 http://openvpn.net/
Source:              http://openvpn.net/release/openvpn-2.0.9.tar.gz

SUNW_BaseDir:        %{_basedir}
SUNW_Copyright:      %{name}.copyright
BuildRoot:           %{_tmppath}/%{name}-%{version}-build
%include default-depend.inc

%package root
Summary:                 %{summary} – / filesystem
SUNW_BaseDir:            /
%include default-depend.inc
Requires: tun

# OpenSolaris IPS Manifest Fields
Meta(info.porter):  Abhishek Gupta < A.Gupta@sun.com >

%description
OpenVPN is a full-featured open source SSL VPN solution that accommodates a wide range of configurations, including remote access, site-to-site VPNs, Wi-Fi security, and enterprise-scale remote access solutions with load balancing, failover, and fine-grained access-controls. Starting with the fundamental premise that complexity is the enemy of security, OpenVPN offers a cost-effective, lightweight alternative to other VPN technologies that is well-targeted for the SME and enterprise markets.

%prep
%setup -q -n openvpn-%version

%build

export CFLAGS=”%optflags”
export LDFLAGS=”%{_ldflags}”

./configure –prefix=%{_prefix} \
–disable-lzo  \
–disable-crypto \
–disable-ssl

make

%install
rm -rf $RPM_BUILD_ROOT

make install DESTDIR=$RPM_BUILD_ROOT

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr (-, root, root)
/usr/man/man8/openvpn.8
/usr/sbin/openvpn

%changelog
* Friday 15 May , 2009 – A.Gupta@sun.com
– initial version

Advertisements

Posted in sun | Tagged: , , , , , , , , , , , , , , , , , | 2 Comments »

4 Days with IPS

Posted by abhiitechie on May 14, 2009

Its been four days for me with IPS and I am proud to say that now I am able to write a post dedicated to the very topic of Image Packaging System and porting packages to OpenSolaris . Engineers from the Solaris team have  been working to create IPS packages for OpenSolaris for most of the existing popular open source softwares which are still not existing as binaries to be directly installed to OpenSolaris and needs to be build from source and along with which lies the tedious task of resolving dependencies which some times becomes almost killing and dis-heartening.

Generating IPS package is similar to RPMs which is popular in GNU/Linux and it also uses a file called a Spec file . So IPS specs are similar to RPM specs with some minor differences.

Need for a Spec file:        

 Typical OSS package builds the code using ./configure ; make ;  make install .  Writing a pkginfo file with package metainfo, like name, version,description etc.  Writing a prototype file with list of files and attributes and not to forget the dependency file. All these requires lots of typing and is error prone to . Because of the tediousness people tend to avoid packaging binary tarballs and even  worse build from source.

So we follow the new approach of buillding and packaging in the same step using Spec files . A typical spec file consists of a simple text metainfo mixed with some perl syntax variables and small shell sripts.Metainfo may consist of name, version, description, etc. of the software .It also applies the code changes called patches to the original source while building. Build instructions are tiny shell scriptlets . Package contents are also specified called globs.

Whats inside a spec file ?

  •  Source code availability (URL)
  •  Local code changes (unified or context diffs)
  •  Build instructions
  •  Lists of files to package up (globs)                
  • Package scripts 
  • Metainfo
  • Build-time and package dependencies
  • Changelog          

What we can do as developers ?

 

● Write a spec file for your favourite app

● Build existing spec files
● Report bugs
● Update packages to the latest version availableBuild the code any way you want
> typical OSS package: ./configure; make;
make install
• Write a pkginfo file:
> package metainfo, like name, version,
description
• Write a prototype file:
> list of files and attributes
• Write a dependency file
  •  Write a spec file for our favourite app
  •  Build existing spec files
  •  Report bugs
  •  Update packages to the latest version available

 

More information in the following URLs

 

Posted in sun | Tagged: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a Comment »