From Electron Cloud
Revision as of 22:51, 26 September 2009 by Ecloud (Talk | contribs)

Jump to: navigation, search

How to build a package yourself, or modify it between unpacking and merging

The following is an old FAQ which has been officially removed for a long time.

I want to perform the ./configure step myself. Can I?

Yes, but it is not trivial, and the next method only works when it is a simple ebuild (i.e. just ./configure and make && make install). Be sure to read the ebuild itself to see how Gentoo handles it.

Start with unpacking the ebuild: ebuild /usr/portage/<category>/<package>/<ebuild> unpack.

Next, go to /var/tmp/portage/<package>-<version>/work. Inside it you'll find the unpacked sources. Execute the steps you need to perform to configure and compile the package.

When finished, execute touch /var/tmp/portage/<package>-<version>/.compiled to trick Portage into thinking it configured and compiled the package. Then finish up with ebuild /usr/portage/<category>/<package>/<ebuild> merge.

Diff between make.conf on two systems

Since the USE flags are in a sort of paragraph rather than one-per-line, diff is hard. Here's a perl program to help:

#!/usr/bin/perl
use IO::Handle;
$numArgs = $#ARGV + 1;
if ($numArgs > 0)
{
        open (MCONF, $ARGV[0]) or die "can't open $ARGV[0] : $!";
}
else
{
        open (MCONF, "/etc/make.conf") or die "can't open /etc/make.conf: $!";
}
my $isuse = 0;
while ( $line = <MCONF> )
{
        if ($line =~ /USE=\"/)
        {
                $isuse = 1;
        }
        if ($isuse)
        {
                if ($line =~ /\"$/)
                {
                        $isuse = 0;
                }
                $line =~ s/USE=\"//;
                $line =~ s/\"//;
                $line =~ s/\n//;
                $line =~ s/\s+/\n/g;
                print $line;
        }
}