Quoting John P. Looney (valen at tuatha.org):
> I'm not sure if these things can be done on debian...but here is hoping.
>> Some of my favourite commands on redhat were:
>> rpm -qf file (find out what package owns a specific file)
> rpm -i http://path.to/source.srpm (install a source rpm)
> rpm -bp SPECS/file.spec (unpack and prepare a source RPM for building)
>> Can these be done on debian ?
John, I see this has been answered a few times, but you might find
worthwhile the snippet I have about this hiding in
http://linuxmafia.com/debian/tips . Quoting:
If you're going to build software from source code, make sure you
install the "build-essential" package.
# apt-get build-dep package
...will ensure that you've satisfied the package's build dependencies.
# apt-get source package
...retrieve the package's source tree, and unpacks it into the current
cd into the tree, and make any desired source changes. The ./debian
directory contains package metadata / build instructions. While in the
source tree, executing
...compiles the package, and places a .deb file in the parent directory,
which you can then install with dkpg -i (using fake root or logged in
as the root user).
# dpkg-buildpackage -us -uc
("-us" means unsigned source. "-uc" means unsigned changes.)
(Alternatively, cd into the source directory, and do "debian/rules
binary" using fakeroot or logged in as the root user.)
The apt-build utility can help this process:
Description: Frontend to apt to build, optimize and install packages
This is an apt-get front-end for compiling software optimized
for your architecture by creating a local repository with built packages.
It can manage system upgrade too.
The pentium-builder package will let you set system-wide options so that
all compiles from source will be optimised for your CPU architecture.
(Despite the name, it can optimise for Athlon, etc.)
The apt-src package is a much cleaner, newer, and more comprehensive
alternative to dpkg-buildpackage, "for downloading, installing,
upgrading, and tracking Debian source packages". The manpage gives
some good examples of usage:
To install the source to pine to /usr/src, build it, and install the
apt-src install --location=/usr/src -i pine
To track changes to said installed pine source package, and install
debs whenever a new version comes out:
apt-src install -i pine
To install a local copy of package foo, which you are going to apply a
local patch to:
apt-src install foo
apt-src build --installdebs foo
To upgrade your local copy of foo, bringing your patch forward, and
building and installing new debs:
apt-src install -i foo
To import the source tree in /usr/src/linux, which you unpacked from a
ftp.kernel.org tarball (or from the kernel-source package) into
apt-src, so it knows about it:
apt-src import kernel --location=/usr/src/linux --version=2.4.18
Quoting author Joey Hess:
"'apt-src install' source gives you a source-version tree in the
directory]. Modify to suit, and 'apt-src build' source. If a new
comes along, 'apt-src upgrade' source to upgrade the tree, patching your
local changes forward. Pass in --installdebs to any of these commands
to make it build and install a .deb."
To compile kernels and auto-generate .deb packages, install and use the
kernel-package package (which provides the make-kpkg utility).
$ cd /directory/where/you/unpacked/a/kernel/tarball
$ make config | make menuconfig | make xconfig | make oldconfig
$ make-kpkg clean
$ make-kpkg --initrd --revision=custom.1.0 kernel_image
# (as root, or using fakeroot) dpkg -i
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!