2005-11-02 15:34:48 +00:00
|
|
|
#! /usr/bin/perl -w
|
|
|
|
|
|
|
|
# Typical command to generate the list of tarballs:
|
2006-06-24 21:31:10 +01:00
|
|
|
|
2007-02-26 16:32:27 +00:00
|
|
|
# export i="http://mirror.switch.ch/ftp/mirror/X11/pub/X11R7.2/src/everything/"; curl $i | perl -e 'while (<>) { if (/href="([^"]*.bz2)"/) { print "$ENV{'i'}$1\n"; }; }' > tarballs
|
|
|
|
# manually added xcb tarballs from http://xcb.freedesktop.org/dist/
|
|
|
|
# then run: perl ./generate-expr-from-tarballs.pl < tarballs
|
2006-06-24 21:31:10 +01:00
|
|
|
|
2005-11-02 15:34:48 +00:00
|
|
|
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
my $tmpDir = "/tmp/xorg-unpack";
|
|
|
|
|
|
|
|
|
|
|
|
my %pkgURLs;
|
|
|
|
my %pkgHashes;
|
|
|
|
my %pkgNames;
|
|
|
|
my %pkgRequires;
|
|
|
|
|
|
|
|
my %pcMap;
|
|
|
|
|
2006-01-09 19:34:26 +00:00
|
|
|
my %extraAttrs;
|
|
|
|
|
2005-11-02 15:34:48 +00:00
|
|
|
|
|
|
|
$pcMap{"freetype2"} = "freetype";
|
|
|
|
$pcMap{"fontconfig"} = "fontconfig";
|
|
|
|
$pcMap{"libpng12"} = "libpng";
|
|
|
|
$pcMap{"libdrm"} = "libdrm";
|
2006-01-09 12:49:21 +00:00
|
|
|
$pcMap{"libXaw"} = "libXaw";
|
2006-01-16 12:46:20 +00:00
|
|
|
$pcMap{"zlib"} = "zlib";
|
2006-01-16 15:07:03 +00:00
|
|
|
$pcMap{"perl"} = "perl";
|
|
|
|
$pcMap{"mesa"} = "mesa";
|
2007-02-26 23:10:25 +00:00
|
|
|
$pcMap{"mesaHeaders"} = "mesaHeaders";
|
2007-02-26 16:32:27 +00:00
|
|
|
$pcMap{"mkfontscale"} = "mkfontscale";
|
|
|
|
$pcMap{"mkfontdir"} = "mkfontdir";
|
|
|
|
$pcMap{"bdftopcf"} = "bdftopcf";
|
|
|
|
$pcMap{"libxslt"} = "libxslt";
|
2008-02-02 20:42:55 +00:00
|
|
|
$pcMap{"dbus-1"} = "dbus";
|
|
|
|
$pcMap{"hal"} = "hal";
|
2007-11-05 23:59:55 +00:00
|
|
|
|
|
|
|
$pcMap{"\$PIXMAN"} = "pixman";
|
|
|
|
$pcMap{"\$RENDERPROTO"} = "renderproto";
|
2006-01-08 20:32:34 +00:00
|
|
|
|
|
|
|
|
2007-11-19 22:29:08 +00:00
|
|
|
$extraAttrs{"xorgserver"} = " mesaSrc = mesa.src; x11BuildHook = ./xorgserver.sh; patches = [./xorgserver-dri-path.patch ./xorgserver-xkbcomp-path.patch ./xorgserver-xkb-leds.patch ]; ";
|
2007-02-26 17:05:27 +00:00
|
|
|
|
2006-01-11 00:21:52 +00:00
|
|
|
$extraAttrs{"imake"} = " inherit xorgcffiles; x11BuildHook = ./imake.sh; patches = [./imake.patch]; ";
|
2006-01-09 19:34:26 +00:00
|
|
|
|
2007-11-19 22:29:08 +00:00
|
|
|
$extraAttrs{"setxkbmap"} = " postInstall = \"ensureDir \$out/share; ln -sfn \${xkeyboard_config}/etc/X11 \$out/share/X11\";";
|
2007-03-30 00:02:07 +01:00
|
|
|
|
2007-02-26 16:32:27 +00:00
|
|
|
$extraAttrs{"fontmiscmisc"} = " postInstall = \"ln -s \${fontalias}/lib/X11/fonts/misc/fonts.alias \$out/lib/X11/fonts/misc/fonts.alias\"; ";
|
|
|
|
|
|
|
|
$extraAttrs{"mkfontdir"} = " preBuild = \"substituteInPlace mkfontdir.cpp --replace BINDIR \${mkfontscale}/bin\"; ";
|
|
|
|
|
2007-11-19 22:29:08 +00:00
|
|
|
$extraAttrs{"xf86inputevdev"} = "
|
|
|
|
preBuild = \"
|
|
|
|
sed -e '/motion_history_proc/d; /history_size/d;' -i src/*.c
|
|
|
|
\";";
|
|
|
|
|
2008-02-02 20:42:55 +00:00
|
|
|
$extraAttrs{"libXpm"} = "
|
|
|
|
patchPhase = \"sed -i '/USE_GETTEXT_TRUE/d' sxpm/Makefile.in cxpm/Makefile.in\";";
|
2006-01-09 19:34:26 +00:00
|
|
|
|
2007-11-05 23:59:55 +00:00
|
|
|
my $downloadCache = "./download-cache";
|
|
|
|
$ENV{'NIX_DOWNLOAD_CACHE'} = $downloadCache;
|
|
|
|
mkdir $downloadCache, 0755;
|
2005-11-02 15:34:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
while (<>) {
|
|
|
|
chomp;
|
2006-06-24 21:31:10 +01:00
|
|
|
my $tarball = "$_";
|
|
|
|
print "\nDOING TARBALL $tarball\n";
|
2005-11-02 15:34:48 +00:00
|
|
|
|
|
|
|
$tarball =~ /\/((?:(?:[A-Za-z0-9]|(?:-[^0-9])|(?:-[0-9]*[a-z]))+))[^\/]*$/;
|
|
|
|
die unless defined $1;
|
|
|
|
my $pkg = $1;
|
|
|
|
$pkg =~ s/-//g;
|
2007-11-05 23:59:55 +00:00
|
|
|
#next unless $pkg eq "xorgserver";
|
|
|
|
#print "$pkg\n";
|
2005-11-02 15:34:48 +00:00
|
|
|
|
2006-06-24 21:31:10 +01:00
|
|
|
$tarball =~ /\/([^\/]*)\.tar\.bz2$/;
|
|
|
|
my $pkgName = $1;
|
|
|
|
|
|
|
|
print " $pkg $pkgName\n";
|
|
|
|
|
|
|
|
if (defined $pkgNames{$pkg}) {
|
|
|
|
print " SKIPPING\n";
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
|
2006-06-24 21:44:19 +01:00
|
|
|
$pkgURLs{$pkg} = $tarball;
|
2006-06-24 21:31:10 +01:00
|
|
|
$pkgNames{$pkg} = $pkgName;
|
|
|
|
|
2007-11-05 23:59:55 +00:00
|
|
|
my ($hash, $path) = `PRINT_PATH=1 QUIET=1 nix-prefetch-url '$tarball'`;
|
2005-11-02 15:34:48 +00:00
|
|
|
chomp $hash;
|
|
|
|
chomp $path;
|
|
|
|
$pkgHashes{$pkg} = $hash;
|
|
|
|
|
|
|
|
print "\nunpacking $path\n";
|
|
|
|
system "rm -rf '$tmpDir'";
|
|
|
|
mkdir $tmpDir, 0700;
|
2006-06-24 21:31:10 +01:00
|
|
|
system "cd '$tmpDir' && tar xfj '$path'";
|
2005-11-02 15:34:48 +00:00
|
|
|
die "cannot unpack `$path'" if $? != 0;
|
|
|
|
print "\n";
|
|
|
|
|
|
|
|
my $provides = `cd '$tmpDir'/* && ls *.pc.in`;
|
|
|
|
my @provides2 = split '\n', $provides;
|
|
|
|
print "PROVIDES @provides2\n\n";
|
|
|
|
foreach my $pc (@provides2) {
|
|
|
|
$pc =~ s/.pc.in//;
|
|
|
|
die "collission with $pcMap{$pc}" if defined $pcMap{$pc};
|
|
|
|
$pcMap{$pc} = $pkg;
|
|
|
|
}
|
|
|
|
|
|
|
|
my @requires = ();
|
2006-01-16 15:07:03 +00:00
|
|
|
my $file;
|
|
|
|
{
|
|
|
|
local $/;
|
2008-02-02 20:42:55 +00:00
|
|
|
open FOO, "cd '$tmpDir'/* && grep -v '^ *#' configure.ac |";
|
2006-01-16 15:07:03 +00: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 16:32:27 +00: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";
|
|
|
|
}
|
|
|
|
|
2007-02-26 20:46:56 +00:00
|
|
|
if ($file =~ /AC_PATH_PROG\(FCCACHE/) {
|
2007-02-26 21:04:36 +00:00
|
|
|
# Don't run fc-cache.
|
|
|
|
die if defined $extraAttrs{$pkg};
|
|
|
|
$extraAttrs{$pkg} = " preInstall = \"installFlags=(FCCACHE=true)\"; ";
|
2007-02-26 20:46:56 +00:00
|
|
|
}
|
|
|
|
|
2006-01-16 15:07:03 +00:00
|
|
|
sub process {
|
|
|
|
my $requires = shift;
|
2007-02-26 16:32:27 +00:00
|
|
|
my $s = shift;
|
|
|
|
$s =~ s/\[/\ /g;
|
|
|
|
$s =~ s/\]/\ /g;
|
|
|
|
$s =~ s/\,/\ /g;
|
|
|
|
foreach my $req (split / /, $s) {
|
2006-01-16 15:07:03 +00:00
|
|
|
next if $req eq ">=";
|
2007-11-05 23:59:55 +00:00
|
|
|
#next if $req =~ /^\$/;
|
2006-01-16 15:07:03 +00:00
|
|
|
next if $req =~ /^[0-9]/;
|
2006-01-17 14:11:43 +00:00
|
|
|
next if $req =~ /^\s*$/;
|
2007-11-05 23:59:55 +00: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 15:07:03 +00:00
|
|
|
print "REQUIRE: $req\n";
|
|
|
|
push @{$requires}, $req;
|
2005-11-02 15:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
2006-01-16 15:07:03 +00:00
|
|
|
|
2007-11-05 23:59:55 +00:00
|
|
|
#process \@requires, $1 while $file =~ /PKG_CHECK_MODULES\([^,]*,\s*[\[]?([^\)\[]*)/g;
|
|
|
|
process \@requires, $1 while $file =~ /PKG_CHECK_MODULES\([^,]*,([^\)\,]*)/g;
|
2006-01-16 15:07:03 +00:00
|
|
|
process \@requires, $1 while $file =~ /MODULES=\"(.*)\"/g;
|
|
|
|
process \@requires, $1 while $file =~ /REQUIRED_LIBS=\"(.*)\"/g;
|
2007-11-05 23:59:55 +00:00
|
|
|
process \@requires, $1 while $file =~ /REQUIRED_MODULES=\"(.*)\"/g;
|
2006-01-16 15:07:03 +00:00
|
|
|
process \@requires, $1 while $file =~ /REQUIRES=\"(.*)\"/g;
|
2007-11-05 23:59:55 +00:00
|
|
|
process \@requires, $1 while $file =~ /XDMCP_MODULES=\"(.*)\"/g;
|
|
|
|
process \@requires, $1 while $file =~ /XORG_MODULES=\"(.*)\"/g;
|
2007-02-26 16:32:27 +00:00
|
|
|
process \@requires, $1 while $file =~ /NEEDED=\"(.*)\"/g;
|
2006-01-17 12:41:27 +00:00
|
|
|
process \@requires, $1 while $file =~ /XORG_DRIVER_CHECK_EXT\([^,]*,([^\)]*)\)/g;
|
2006-01-16 15:07:03 +00:00
|
|
|
|
2007-02-26 23:10:25 +00:00
|
|
|
push @requires, "glproto", "mesaHeaders" if $pkg =~ /xf86videoi810/;
|
2007-11-19 22:29:08 +00:00
|
|
|
push @requires, "glproto", "mesaHeaders" if $pkg =~ /xf86videosis/;
|
2007-04-18 16:46:58 +01:00
|
|
|
push @requires, "glproto", "mesaHeaders" if $pkg =~ /xf86videointel/;
|
2006-01-16 15:07:03 +00:00
|
|
|
push @requires, "zlib" if $pkg =~ /xorgserver/;
|
2007-11-05 23:59:55 +00:00
|
|
|
push @requires, "xf86bigfontproto" if $pkg =~ /xorgserver/;
|
2007-02-26 16:32:27 +00:00
|
|
|
push @requires, "libxslt" if $pkg =~ /libxcb/;
|
2006-01-16 15:07:03 +00:00
|
|
|
|
|
|
|
print "REQUIRES @requires => $pkg\n";
|
2005-11-02 15:34:48 +00:00
|
|
|
$pkgRequires{$pkg} = \@requires;
|
|
|
|
|
|
|
|
print "done\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
print "\nWRITE OUT\n";
|
|
|
|
|
2006-06-24 21:31:10 +01:00
|
|
|
open OUT, ">default2.nix";
|
2005-11-02 15:34:48 +00:00
|
|
|
|
|
|
|
print OUT "";
|
|
|
|
print OUT <<EOF;
|
|
|
|
# This is a generated file. Do not edit!
|
2008-02-02 20:42:55 +00:00
|
|
|
args: with args;
|
2005-11-02 15:34:48 +00:00
|
|
|
|
|
|
|
rec {
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
2006-01-08 20:32:34 +00:00
|
|
|
foreach my $pkg (sort (keys %pkgURLs)) {
|
2005-11-02 15:34:48 +00:00
|
|
|
print "$pkg\n";
|
|
|
|
|
2006-01-09 21:39:47 +00:00
|
|
|
my %requires = ();
|
2005-11-02 15:34:48 +00:00
|
|
|
my $inputs = "";
|
2006-01-09 21:39:47 +00:00
|
|
|
foreach my $req (sort @{$pkgRequires{$pkg}}) {
|
2005-11-02 15:34:48 +00:00
|
|
|
if (defined $pcMap{$req}) {
|
2006-01-09 21:39:47 +00:00
|
|
|
if (!defined $requires{$pcMap{$req}}) {
|
|
|
|
$inputs .= "$pcMap{$req} ";
|
|
|
|
$requires{$pcMap{$req}} = 1;
|
|
|
|
}
|
2005-11-02 15:34:48 +00:00
|
|
|
} else {
|
|
|
|
print " NOT FOUND: $req\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-09 19:34:26 +00:00
|
|
|
my $extraAttrs = $extraAttrs{"$pkg"};
|
|
|
|
$extraAttrs = "" unless defined $extraAttrs;
|
|
|
|
|
2005-11-02 15:34:48 +00:00
|
|
|
print OUT <<EOF
|
2006-01-09 21:39:47 +00:00
|
|
|
$pkg = (stdenv.mkDerivation {
|
2005-11-02 15:34:48 +00:00
|
|
|
name = "$pkgNames{$pkg}";
|
2006-01-08 22:09:44 +00:00
|
|
|
builder = ./builder.sh;
|
2005-11-02 15:34:48 +00:00
|
|
|
src = fetchurl {
|
|
|
|
url = $pkgURLs{$pkg};
|
2007-02-26 16:32:27 +00:00
|
|
|
sha256 = "$pkgHashes{$pkg}";
|
2005-11-02 15:34:48 +00:00
|
|
|
};
|
2006-01-09 19:34:26 +00:00
|
|
|
buildInputs = [pkgconfig $inputs];$extraAttrs
|
2006-01-09 21:39:47 +00:00
|
|
|
}) // {inherit $inputs;};
|
2005-11-02 15:34:48 +00:00
|
|
|
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
print OUT "}\n";
|
|
|
|
|
|
|
|
close OUT;
|