I use KDevelop as my main IDE and I’m pretty satisfied. KDevelop can create a source archive of the project’s source code automatically for you which simplifies the distribution of the project. Unfortunately the archive created isn’t ready for distribution. The user can’t just run ./configure ; make
as he needs to run all the automake tools before. Not ideal for distributing. So you need to convert this source archive to a source package which is ready for the user to compile immediately
#!/usr/bin/python
"""
packsource.py
Version: 1.0
This script takes a tar.gz source archive created by KDevelop and turns
it into a source package, which the will be able just to use
./configure ; make ; make install
to build (instead of using autotools).
Synopsis:
python packsource.py SomeProject-1.4.tar.gz
The SomeProject-1.4.tar.gz will be overwritten with a new tar containg
the source package.
"""
###########################################################################
# Copyright (C) 2007 by Guy Rutenberg #
# guyrutenberg@gmail.com #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the #
# Free Software Foundation, Inc., #
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #
############################################################################
import os,sys,shutil,tempfile
tempdir = tempfile.mkdtemp()
print "Extracting source archive..."
args=['tar', '-zxf', sys.argv[1], '-C', tempdir]
os.spawnvp(os.P_WAIT, args[0], args)
print "Source archive extracted"
origpwd = os.getcwd()
dirlist = os.listdir(tempdir)
os.chdir(tempdir + "/" + dirlist[0])
args=['aclocal'];
print "Running", " ".join(args)
os.spawnvp(os.P_WAIT, args[0], args)
args=['autoheader'];
print "Running", " ".join(args)
os.spawnvp(os.P_WAIT, args[0], args)
args=['libtoolize', '--copy', '--force', '--automake']
print "Running", " ".join(args);
os.spawnvp(os.P_WAIT, args[0], args)
args=['automake', '-a', '-c']
print "Running", " ".join(args);
os.spawnvp(os.P_WAIT, args[0], args)
args=['autoconf'];
print "Running", " ".join(args)
os.spawnvp(os.P_WAIT, args[0], args)
print "Removing automake cache files"
shutil.rmtree('autom4te.cache/')
os.chdir('..')
print "Building source package"
args=['tar', '-zcf', os.path.split(sys.argv[1])[1], dirlist[0]]
os.spawnvp(os.P_WAIT, args[0], args)
shutil.copy(os.path.split(sys.argv[1])[1], origpwd)
os.chdir(origpwd)
print "Clearing up..."
shutil.rmtree(tempdir)
print "Done"
To use the script just call it and pass the source archive filename to the script as an argument. The script takes the source archive and overwrites it as a source package which will be easy for users to install.
Update (16/9/2007)
Removed an unneeded module dependency.