I’m still having trouble figuring out the individual Debian packaging utilites (dh_buildpackage, dh_gencontrol, etc), but I’ve figured out a slightly inconvinent way to do what I want: get the program source, and build as a .deb package that I can uninstall with apt.
1. Download the stuff the program I want to compile requires — for example, links2, the graphics-capable version of links.
$ sudo apt-get install build-essential debhelper \
&& sudo apt-get build-dep links2 --no-install-recommends
2. Make a subdirectory in my home directory:
$ mkdir build
3. Download the program source code & available patches, extract from archive, and apply patches in one easy step (note that you don’t have to be, and should not be, root):
$ apt-get source links2
4. Change to the created directory:
$ cd links2*
5. Edit the rules file, which will determine what commands are sent to the compiler. I think. Seems to work, anyway.
$ nano Debian/rules
Scroll down to CFLAGS, and add the following (for a Pentium 3)
-march=pentium3 -mtune=pentium3 -O2 -pipe -fomit-frame-pointer -funroll-loops
You can also add -ffast-math, but don’t come crying to me if something doesn’t work right as a result. It’s considered unsafe. That said, I haven’t seen a problem on this paticular program. http://en.gentoo-wiki.com/wiki/Safe_Cflags has a list of safe CFLAGS, and http://en.gentoo-wiki.com/wiki/CFLAGS has a list of flags that are less safe. These links will open in a new window, btw, if your browser doesn’t support tabbed browsing.
6. Now package it. The resulting .deb files will be created in the directory above where you are now.
$ fakeroot dpkg-buildpackage
7. Change directory to where the new packages are, and install the links2 package.
$ cd .. && sudo dpkg -i links2*.deb
Works for me. Unfortunately, this only changes what compiler flags the package is made with; this is great for optimizing the software to your paticular processor, without giving up Debian’s wonderful package system, but does nothing for tell what options of the software itself to compile with those optimizations. For example, when I compile links2, I don’t want the atheos or pmshell graphic drivers. I don’t even know what those are :shock:. If I install it using the ./configure -> make -> sudo make install process, I can tell it to disable those capabilites, but I don’t get a nice, neat little .deb package.
I need to read more in the Debian wiki, I guess. Hopefully, w3m posts this correctly, because I don’t have Iceweasel installed, am sick of Kazehakase crashing whenever I watch more than 2 or 3 Flash videos in a row (irregardless of what player I use), don’t have Midori available, and can’t get links2 or elinks-lite to work with WordPress yet.
EDIT: It posted, but there were formatting errors. w3m sent me into Nano to create the post, so hitting Enter at the end of a line did not translate into a line-wrap in the post. Using the HTML tag for bold text did, however, so I just have to look up the tag for line-wrap and everything should be fine.
Speaking of w3m, if you use it with a framebuffer or on an X server on Debian, I recommend the w3m-img package. Strangely, the images don’t show up if you page-up to them, but work just fine if you page-down to them. Hmm…I should see if there’s a bug-report on that.