2005-11-02 18:34:48 +03:00
|
|
|
#! /usr/bin/perl -w
|
|
|
|
|
|
|
|
# Typical command to generate the list of tarballs:
|
2006-06-25 00:31:10 +04:00
|
|
|
|
2011-12-31 10:07:23 +04:00
|
|
|
# export i="mirror://xorg/X11R7.6/src/everything/"; cat $(PRINT_PATH=1 nix-prefetch-url $i | tail -n 1) | perl -e 'while (<>) { if (/(href|HREF)="([^"]*.bz2)"/) { print "$ENV{'i'}$2\n"; }; }' | sort > tarballs-7.6.list
|
2008-10-08 21:02:48 +04:00
|
|
|
# manually update extra.list
|
2011-12-31 19:37:51 +04:00
|
|
|
# then run: cat tarballs-7.6.list extra.list old.list | perl ./generate-expr-from-tarballs.pl
|
|
|
|
# tarballs-x.y.list is generated + changes for individual packages
|
|
|
|
# extra.list are packages not contained in the tarballs
|
|
|
|
# old.list are packages that used to be part of the tarballs
|
|
|
|
|
2005-11-02 18:34:48 +03:00
|
|
|
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
my $tmpDir = "/tmp/xorg-unpack";
|
|
|
|
|
|
|
|
|
|
|
|
my %pkgURLs;
|
|
|
|
my %pkgHashes;
|
|
|
|
my %pkgNames;
|
|
|
|
my %pkgRequires;
|
|
|
|
|
|
|
|
my %pcMap;
|
|
|
|
|
2006-01-09 22:34:26 +03:00
|
|
|
my %extraAttrs;
|
|
|
|
|
2005-11-02 18:34:48 +03:00
|
|
|
|
2010-07-20 23:24:21 +04:00
|
|
|
my @missingPCs = ("fontconfig", "libdrm", "libXaw", "zlib", "perl", "python", "mesa", "mkfontscale", "mkfontdir", "bdftopcf", "libxslt", "openssl", "gperf", "m4");
|
2008-10-14 18:46:56 +04:00
|
|
|
$pcMap{$_} = $_ foreach @missingPCs;
|
2005-11-02 18:34:48 +03:00
|
|
|
$pcMap{"freetype2"} = "freetype";
|
|
|
|
$pcMap{"libpng12"} = "libpng";
|
2011-02-08 20:39:28 +03:00
|
|
|
$pcMap{"libpng"} = "libpng";
|
2008-02-02 23:42:55 +03:00
|
|
|
$pcMap{"dbus-1"} = "dbus";
|
2009-06-15 20:45:48 +04:00
|
|
|
$pcMap{"uuid"} = "libuuid";
|
2011-02-08 20:39:28 +03:00
|
|
|
$pcMap{"libudev"} = "udev";
|
2008-10-08 21:02:48 +04:00
|
|
|
$pcMap{"gl"} = "mesa";
|
2007-11-06 02:59:55 +03:00
|
|
|
$pcMap{"\$PIXMAN"} = "pixman";
|
|
|
|
$pcMap{"\$RENDERPROTO"} = "renderproto";
|
2006-01-08 23:32:34 +03:00
|
|
|
|
|
|
|
|
2007-11-06 02:59:55 +03:00
|
|
|
my $downloadCache = "./download-cache";
|
|
|
|
$ENV{'NIX_DOWNLOAD_CACHE'} = $downloadCache;
|
|
|
|
mkdir $downloadCache, 0755;
|
2005-11-02 18:34:48 +03:00
|
|
|
|
|
|
|
|
|
|
|
while (<>) {
|
|
|
|
chomp;
|
2006-06-25 00:31:10 +04:00
|
|
|
my $tarball = "$_";
|
|
|
|
print "\nDOING TARBALL $tarball\n";
|
2005-11-02 18:34:48 +03:00
|
|
|
|
2011-12-31 10:07:32 +04:00
|
|
|
my $pkg;
|
|
|
|
if ($tarball =~ s/:([a-zA-Z0-9_]+)$//) {
|
|
|
|
$pkg = $1;
|
|
|
|
} else {
|
|
|
|
$tarball =~ /\/((?:(?:[A-Za-z0-9]|(?:-[^0-9])|(?:-[0-9]*[a-z]))+))[^\/]*$/;
|
|
|
|
die unless defined $1;
|
|
|
|
$pkg = $1;
|
|
|
|
$pkg =~ s/-//g;
|
|
|
|
#next unless $pkg eq "xcbutil";
|
|
|
|
}
|
2005-11-02 18:34:48 +03:00
|
|
|
|
2006-06-25 00:31:10 +04:00
|
|
|
$tarball =~ /\/([^\/]*)\.tar\.bz2$/;
|
|
|
|
my $pkgName = $1;
|
|
|
|
|
|
|
|
print " $pkg $pkgName\n";
|
|
|
|
|
|
|
|
if (defined $pkgNames{$pkg}) {
|
|
|
|
print " SKIPPING\n";
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
|
2006-06-25 00:44:19 +04:00
|
|
|
$pkgURLs{$pkg} = $tarball;
|
2006-06-25 00:31:10 +04:00
|
|
|
$pkgNames{$pkg} = $pkgName;
|
|
|
|
|
2007-11-06 02:59:55 +03:00
|
|
|
my ($hash, $path) = `PRINT_PATH=1 QUIET=1 nix-prefetch-url '$tarball'`;
|
2005-11-02 18:34:48 +03:00
|
|
|
chomp $hash;
|
|
|
|
chomp $path;
|
|
|
|
$pkgHashes{$pkg} = $hash;
|
|
|
|
|
|
|
|
print "\nunpacking $path\n";
|
|
|
|
system "rm -rf '$tmpDir'";
|
|
|
|
mkdir $tmpDir, 0700;
|
2006-06-25 00:31:10 +04:00
|
|
|
system "cd '$tmpDir' && tar xfj '$path'";
|
2005-11-02 18:34:48 +03:00
|
|
|
die "cannot unpack `$path'" if $? != 0;
|
|
|
|
print "\n";
|
|
|
|
|
2009-04-20 20:02:50 +04:00
|
|
|
my $pkgDir = `echo $tmpDir/*`;
|
|
|
|
chomp $pkgDir;
|
|
|
|
|
2010-07-19 12:59:05 +04:00
|
|
|
my $provides = `find $pkgDir -name "*.pc.in"`;
|
2005-11-02 18:34:48 +03:00
|
|
|
my @provides2 = split '\n', $provides;
|
2009-04-20 20:02:50 +04:00
|
|
|
my @requires = ();
|
|
|
|
|
|
|
|
foreach my $pcFile (@provides2) {
|
|
|
|
my $pc = $pcFile;
|
2010-07-19 12:59:05 +04:00
|
|
|
$pc =~ s/.*\///;
|
2005-11-02 18:34:48 +03:00
|
|
|
$pc =~ s/.pc.in//;
|
2010-07-19 12:59:05 +04:00
|
|
|
print "PROVIDES $pc\n";
|
|
|
|
die "collision with $pcMap{$pc}" if defined $pcMap{$pc};
|
2005-11-02 18:34:48 +03:00
|
|
|
$pcMap{$pc} = $pkg;
|
2009-04-20 20:02:50 +04:00
|
|
|
|
2010-07-19 12:59:05 +04:00
|
|
|
open FOO, "<$pcFile" or die;
|
2009-04-20 20:02:50 +04:00
|
|
|
while (<FOO>) {
|
|
|
|
if (/Requires:(.*)/) {
|
|
|
|
my @reqs = split ' ', $1;
|
|
|
|
foreach my $req (@reqs) {
|
|
|
|
next unless $req =~ /^[a-z]+$/;
|
2010-07-19 12:59:05 +04:00
|
|
|
print "REQUIRE (from $pc): $req\n";
|
2009-04-20 20:02:50 +04:00
|
|
|
push @requires, $req;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
close FOO;
|
|
|
|
|
2005-11-02 18:34:48 +03:00
|
|
|
}
|
|
|
|
|
2006-01-16 18:07:03 +03:00
|
|
|
my $file;
|
|
|
|
{
|
|
|
|
local $/;
|
2008-02-02 23:42:55 +03:00
|
|
|
open FOO, "cd '$tmpDir'/* && grep -v '^ *#' configure.ac |";
|
2006-01-16 18:07:03 +03:00
|
|
|
$file = <FOO>;
|
|
|
|
close FOO;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($file =~ /XAW_CHECK_XPRINT_SUPPORT/) {
|
|
|
|
push @requires, "libXaw";
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($file =~ /zlib is required/ || $file =~ /AC_CHECK_LIB\(z\,/) {
|
|
|
|
push @requires, "zlib";
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($file =~ /Perl is required/) {
|
|
|
|
push @requires, "perl";
|
|
|
|
}
|
|
|
|
|
2007-02-26 19:32:27 +03:00
|
|
|
if ($file =~ /AC_PATH_PROG\(BDFTOPCF/) {
|
|
|
|
push @requires, "bdftopcf";
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($file =~ /AC_PATH_PROG\(MKFONTSCALE/) {
|
|
|
|
push @requires, "mkfontscale";
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($file =~ /AC_PATH_PROG\(MKFONTDIR/) {
|
|
|
|
push @requires, "mkfontdir";
|
|
|
|
}
|
|
|
|
|
2008-10-08 21:02:48 +04:00
|
|
|
if ($file =~ /AM_PATH_PYTHON/) {
|
|
|
|
push @requires, "python";
|
|
|
|
}
|
|
|
|
|
2007-02-26 23:46:56 +03:00
|
|
|
if ($file =~ /AC_PATH_PROG\(FCCACHE/) {
|
2007-02-27 00:04:36 +03:00
|
|
|
# Don't run fc-cache.
|
|
|
|
die if defined $extraAttrs{$pkg};
|
|
|
|
$extraAttrs{$pkg} = " preInstall = \"installFlags=(FCCACHE=true)\"; ";
|
2007-02-26 23:46:56 +03:00
|
|
|
}
|
|
|
|
|
2009-10-30 11:20:03 +03:00
|
|
|
my $isFont;
|
|
|
|
|
|
|
|
if ($file =~ /XORG_FONT_BDF_UTILS/) {
|
|
|
|
push @requires, "bdftopcf", "mkfontdir";
|
|
|
|
$isFont = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($file =~ /XORG_FONT_SCALED_UTILS/) {
|
|
|
|
push @requires, "mkfontscale", "mkfontdir";
|
|
|
|
$isFont = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($file =~ /XORG_FONT_UCS2ANY/) {
|
|
|
|
push @requires, "fontutil";
|
|
|
|
$isFont = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($isFont) {
|
|
|
|
$extraAttrs{$pkg} = " configureFlags = \"--with-fontrootdir=\$(out)/lib/X11/fonts\"; ";
|
|
|
|
}
|
|
|
|
|
2006-01-16 18:07:03 +03:00
|
|
|
sub process {
|
|
|
|
my $requires = shift;
|
2007-02-26 19:32:27 +03:00
|
|
|
my $s = shift;
|
|
|
|
$s =~ s/\[/\ /g;
|
|
|
|
$s =~ s/\]/\ /g;
|
|
|
|
$s =~ s/\,/\ /g;
|
|
|
|
foreach my $req (split / /, $s) {
|
2006-01-16 18:07:03 +03:00
|
|
|
next if $req eq ">=";
|
2007-11-06 02:59:55 +03:00
|
|
|
#next if $req =~ /^\$/;
|
2006-01-16 18:07:03 +03:00
|
|
|
next if $req =~ /^[0-9]/;
|
2006-01-17 17:11:43 +03:00
|
|
|
next if $req =~ /^\s*$/;
|
2007-11-06 02:59:55 +03:00
|
|
|
next if $req eq '$REQUIRED_MODULES';
|
|
|
|
next if $req eq '$REQUIRED_LIBS';
|
|
|
|
next if $req eq '$XDMCP_MODULES';
|
|
|
|
next if $req eq '$XORG_MODULES';
|
2006-01-16 18:07:03 +03:00
|
|
|
print "REQUIRE: $req\n";
|
|
|
|
push @{$requires}, $req;
|
2005-11-02 18:34:48 +03:00
|
|
|
}
|
|
|
|
}
|
2006-01-16 18:07:03 +03:00
|
|
|
|
2007-11-06 02:59:55 +03:00
|
|
|
#process \@requires, $1 while $file =~ /PKG_CHECK_MODULES\([^,]*,\s*[\[]?([^\)\[]*)/g;
|
|
|
|
process \@requires, $1 while $file =~ /PKG_CHECK_MODULES\([^,]*,([^\)\,]*)/g;
|
2006-01-16 18:07:03 +03:00
|
|
|
process \@requires, $1 while $file =~ /MODULES=\"(.*)\"/g;
|
|
|
|
process \@requires, $1 while $file =~ /REQUIRED_LIBS=\"(.*)\"/g;
|
2007-11-06 02:59:55 +03:00
|
|
|
process \@requires, $1 while $file =~ /REQUIRED_MODULES=\"(.*)\"/g;
|
2006-01-16 18:07:03 +03:00
|
|
|
process \@requires, $1 while $file =~ /REQUIRES=\"(.*)\"/g;
|
2010-07-19 01:51:13 +04:00
|
|
|
process \@requires, $1 while $file =~ /X11_REQUIRES=\'(.*)\'/g;
|
2007-11-06 02:59:55 +03:00
|
|
|
process \@requires, $1 while $file =~ /XDMCP_MODULES=\"(.*)\"/g;
|
|
|
|
process \@requires, $1 while $file =~ /XORG_MODULES=\"(.*)\"/g;
|
2007-02-26 19:32:27 +03:00
|
|
|
process \@requires, $1 while $file =~ /NEEDED=\"(.*)\"/g;
|
2006-01-17 15:41:27 +03:00
|
|
|
process \@requires, $1 while $file =~ /XORG_DRIVER_CHECK_EXT\([^,]*,([^\)]*)\)/g;
|
2006-01-16 18:07:03 +03:00
|
|
|
|
2007-02-26 19:32:27 +03:00
|
|
|
push @requires, "libxslt" if $pkg =~ /libxcb/;
|
2008-10-14 18:46:56 +04:00
|
|
|
push @requires, "gperf", "m4", "xproto" if $pkg =~ /xcbutil/;
|
2006-01-16 18:07:03 +03:00
|
|
|
|
2009-04-20 20:02:50 +04:00
|
|
|
print "REQUIRES $pkg => @requires\n";
|
2005-11-02 18:34:48 +03:00
|
|
|
$pkgRequires{$pkg} = \@requires;
|
|
|
|
|
|
|
|
print "done\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
print "\nWRITE OUT\n";
|
|
|
|
|
2008-10-09 16:12:58 +04:00
|
|
|
open OUT, ">default.nix";
|
2005-11-02 18:34:48 +03:00
|
|
|
|
|
|
|
print OUT "";
|
|
|
|
print OUT <<EOF;
|
2009-04-28 17:58:35 +04:00
|
|
|
# THIS IS A GENERATED FILE. DO NOT EDIT!
|
2008-02-02 23:42:55 +03:00
|
|
|
args: with args;
|
2005-11-02 18:34:48 +03:00
|
|
|
|
2009-04-28 17:58:35 +04:00
|
|
|
let
|
|
|
|
|
|
|
|
overrides = import ./overrides.nix {inherit args xorg;};
|
|
|
|
|
|
|
|
xorg = rec {
|
2005-11-02 18:34:48 +03:00
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
2006-01-08 23:32:34 +03:00
|
|
|
foreach my $pkg (sort (keys %pkgURLs)) {
|
2005-11-02 18:34:48 +03:00
|
|
|
print "$pkg\n";
|
|
|
|
|
2006-01-10 00:39:47 +03:00
|
|
|
my %requires = ();
|
2005-11-02 18:34:48 +03:00
|
|
|
my $inputs = "";
|
2006-01-10 00:39:47 +03:00
|
|
|
foreach my $req (sort @{$pkgRequires{$pkg}}) {
|
2005-11-02 18:34:48 +03:00
|
|
|
if (defined $pcMap{$req}) {
|
2009-04-20 20:02:50 +04:00
|
|
|
# Some packages have .pc that depends on itself.
|
|
|
|
next if $pcMap{$req} eq $pkg;
|
2006-01-10 00:39:47 +03:00
|
|
|
if (!defined $requires{$pcMap{$req}}) {
|
|
|
|
$inputs .= "$pcMap{$req} ";
|
|
|
|
$requires{$pcMap{$req}} = 1;
|
|
|
|
}
|
2005-11-02 18:34:48 +03:00
|
|
|
} else {
|
|
|
|
print " NOT FOUND: $req\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-09 22:34:26 +03:00
|
|
|
my $extraAttrs = $extraAttrs{"$pkg"};
|
|
|
|
$extraAttrs = "" unless defined $extraAttrs;
|
|
|
|
|
2005-11-02 18:34:48 +03:00
|
|
|
print OUT <<EOF
|
2009-04-28 17:58:35 +04:00
|
|
|
$pkg = (stdenv.mkDerivation ((if overrides ? $pkg then overrides.$pkg else x: x) {
|
2005-11-02 18:34:48 +03:00
|
|
|
name = "$pkgNames{$pkg}";
|
2006-01-09 01:09:44 +03:00
|
|
|
builder = ./builder.sh;
|
2005-11-02 18:34:48 +03:00
|
|
|
src = fetchurl {
|
|
|
|
url = $pkgURLs{$pkg};
|
2007-02-26 19:32:27 +03:00
|
|
|
sha256 = "$pkgHashes{$pkg}";
|
2005-11-02 18:34:48 +03:00
|
|
|
};
|
2006-01-09 22:34:26 +03:00
|
|
|
buildInputs = [pkgconfig $inputs];$extraAttrs
|
2009-04-28 17:58:35 +04:00
|
|
|
})) // {inherit $inputs;};
|
2005-11-02 18:34:48 +03:00
|
|
|
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
2009-04-28 17:58:35 +04:00
|
|
|
print OUT "}; in xorg\n";
|
2005-11-02 18:34:48 +03:00
|
|
|
|
|
|
|
close OUT;
|