dimitris kalamaras

mathematics, social network analysis, free software…

RPM .specs, for a Qt4 application

Been busy the last few days; mostly reading math but occasionally I would steal some time (preferably late at night or in the afternoons) to hack on SocNetV — btw, I released a bugfix 0.47 a couple of days ago.

Today, I decided to check on SUSE Build Service. This is a complete distribution development platform that provides the means to build packages for openSUSE distributions as well as most other Linux distributions. The whole idea seemed to be “upload your source tarball and a spec, and we’ll make binary packages for you for every distro you name”. This is just awesome, if you think about it, cause it takes all the trouble from the developer. Well, I was reading their manual, trying to understand which-is-which and what-to-do-to-build-my-great-package, when I realized that I could easily make an RPM for SocNetV with no hassles, and no Build Service at all. You see, we had a very nice tutorial on building RPM packages in the Greek edition of Linux Format magazine. At the time, I hadn’t test the instructions in real world examples, but hey ..it couldn’t be that hard! And it wasn’t. Actually, it was far easier than I thought in the first place…

In reality, all you need to build a nice spec is

  1. a nice and well-written .spec example, and
  2. to start packaging with a simple application (aka very few  dependencies).

I started from the KDE3 examples in “SUSE_packaging_conventions” documents and tried to adapt one of these to SocNetV. After a few trial-and-error attempts, I got myself on the right track. SocNetV was ideal for me, since it only depends on Qt 4.4 and (lucky me!) I have just added autoconf/automake support… After reading a little bit of the SUSE RPM packaging guidelines, adapting some SocNetV files (i.e. configure.ac, Makefile.in and socnetv.spec.in) and reading back the Greek Linux Format tutorial, I was able to create my first SocNetV RPM package for openSUSE! What is more, with pretty much the same .spec I can build RPMs for Fedora or Mandriva as well, since I added some distro defines. Therefore, the next release (0.48) of SocNetV will be both in source tarball and RPM packages. Youpie!

For the record, this is my first successful .spec:

%define name    socnetv
%define version @PACKAGE_VERSION@
%define release 1
%define prefix  @ac_prefix@
%define is_mandrake %(test -e /etc/mandrake-release && echo 1 || echo 0)
%define is_suse %(test -e /etc/SuSE-release && echo 1 || echo 0)
%define is_fedora %(test -e /etc/fedora-release && echo 1 || echo 0)
%define qmake qmake
%define lrelease lrelease
%if %is_fedora
%define distr %(cat /etc/fedora-release)
%define qmake qmake-qt4
%define lrelease lrelease-qt4
%if %is_suse
%define distr %(head -1 /etc/SuSE-release)
%if %is_mandrake
%define distr %(cat /etc/mandrake-release)
Name:		%{name}
Summary:	A Social Networks Analyser and Visualiser
License:	GPLv3
Group:		Science/Mathematics
URL:		http://socnetv.sourceforge.net/
Version:	%{version}
Release:	%{release}
Prefix:		%{prefix}
Source0:	SocNetV-%{version}.tar.gz
Packager:	Dimitris V. Kalamaras
Distribution:   %{distr}
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-buildroot
BuildRequires:	libqt4-devel >= 4.4
SocNetV (Social Networks Visualiser) is a flexible and
user-friendly tool for Social Networks Analysis and Visualisation.
It lets you create new networks (graphs) with a few clicks on a
virtual canvas or load networks of various formats (GraphViz,
GraphML, Adjacency, Pajek, etc) and modify them to suit your needs.
Author: Dimitris V. Kalamaras 
[ -f Makefile.cvs ] && %__make -f Makefile.cvs
[ -d %{buildroot} -a "%{buildroot}" != "" ] && %__rm -rf  %{buildroot}
* Tue Sep 7 2008 Dimitris Kalamaras
- First RPM release


SocNetV 0.46 is here!


SocNetV gets a review (not bad one :))


  1. hawkeye

    That’s cool, Dimitri!
    What about .deb packages?
    Any clues on that?


  2. Well, if you mean SocNetV packages, you can find an older version in Debian experimental, courtesy of serzan. 😉

  3. Good work! Thank you very much!
    I always wanted to write in my site something like that. Can I take part of your post to my blog?
    Of course, I will add backlink?

    Regards, Timur I.

  4. Yes, Timur, of course you can use my stuff in your site. Just mention the source somewhere! 🙂

  5. Great article. I’m glad I found it. All the best, Antoine

Leave a Reply

Creative Commons License
Licensed under a Creative Commons Attribution-ShareAlike 4.0 International License - Powered by Linux