I have never did packaging in linux platform and had faced a lot of problem in creating a simple spec file. Now as I have through with it I want to share this information in my Blog.
The major portion in linux packaging process is to create a right spec file. Here I am giving a sample and simplest spec file. Assumptions here are we want software get install in /opt/package- name/lib and /opt/package- name/bin directory. Given below is the containt of “Package name”.spec file :-
Summary: Write name of project
Name: Package name
Group: wite any group name (for detail could go any link given below)
Project description that will come as information after installation of package.
mkdir -p $RPM_BUILD_ROOT/opt/write you package name/bin/
mkdir -p $RPM_BUILD_ROOT/opt/write your package name /lib/
install -s -m 0755 /usr/src/packages/BUILD/-/opt/write you package name/bin/* $RPM_BUILD_ROOT/opt/write you package name/bin/
install -s -m 0755 /usr/src/packages/BUILD/-/opt/write you package name/lib/*.so* $RPM_BUILD_ROOT/opt/write you package name/lib/
rm -rf $RPM_BUILD_ROOT
/opt/write you package name/bin/*
/opt/write you package name/lib/*.so*
Now simply you need to run following commands
1) Create a rpm file in default folder of /usr/src/packages/RPMS
rpmbuild -ba /usr/src/packages/SPECS/package_name.spec
2) Install rpmfile to the location provided by you in spec file
rpm -ivh /usr/src/packages/RPMS/******.rpm
3) Remove software from the platform
rpm -e magnum-lda
4) Query the package and get detail that you have specified in spec file.
rpm -qpl magnum-lda-1.0.0-1.x86_64.rpm