From beda10f5a2a69ac32ad91c8a80477fde19be6a83 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 15 Mar 2004 15:23:53 +0000 Subject: * Make perl a dependency of Nix. --- configure.ac | 5 +++ corepkgs/buildenv/Makefile.am | 4 ++- corepkgs/buildenv/builder.pl | 72 ----------------------------------------- corepkgs/buildenv/builder.pl.in | 72 +++++++++++++++++++++++++++++++++++++++++ scripts/nix-collect-garbage.in | 2 +- scripts/nix-install-package.in | 2 +- scripts/nix-prefetch-url.in | 2 +- scripts/nix-pull.in | 2 +- scripts/nix-push.in | 2 +- substitute.mk | 1 + 10 files changed, 86 insertions(+), 78 deletions(-) delete mode 100755 corepkgs/buildenv/builder.pl create mode 100755 corepkgs/buildenv/builder.pl.in diff --git a/configure.ac b/configure.ac index 689c2617e15d..093812e7acc0 100644 --- a/configure.ac +++ b/configure.ac @@ -47,6 +47,11 @@ AC_PATH_PROG(xmllint, xmllint) AC_PATH_PROG(xsltproc, xsltproc) AC_PATH_PROG(flex, flex, false) AC_PATH_PROG(bison, bison, false) +AC_PATH_PROG(perl, perl) +if test -z "$perl"; then + echo "Perl is required for Nix." + exit 1 +fi AC_ARG_WITH(docbook-catalog, AC_HELP_STRING([--with-docbook-catalog=PATH], [path of the DocBook XML DTD]), diff --git a/corepkgs/buildenv/Makefile.am b/corepkgs/buildenv/Makefile.am index f6a14600f3c4..7a5df476d3d8 100644 --- a/corepkgs/buildenv/Makefile.am +++ b/corepkgs/buildenv/Makefile.am @@ -1,3 +1,5 @@ +all-local: builder.pl + install-exec-local: $(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs $(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs/buildenv @@ -6,4 +8,4 @@ install-exec-local: include ../../substitute.mk -EXTRA_DIST = default.nix builder.pl +EXTRA_DIST = default.nix builder.pl.in diff --git a/corepkgs/buildenv/builder.pl b/corepkgs/buildenv/builder.pl deleted file mode 100755 index 3bbb178c8570..000000000000 --- a/corepkgs/buildenv/builder.pl +++ /dev/null @@ -1,72 +0,0 @@ -#! /usr/bin/perl -w - -use strict; -use Cwd; - -my $selfdir = $ENV{"out"}; -mkdir "$selfdir", 0755 || die "error creating $selfdir"; - -# For each activated package, create symlinks. - -sub createLinks { - my $srcdir = shift; - my $dstdir = shift; - - my @srcfiles = glob("$srcdir/*"); - - foreach my $srcfile (@srcfiles) { - my $basename = $srcfile; - $basename =~ s/^.*\///g; # strip directory - my $dstfile = "$dstdir/$basename"; - if ($srcfile =~ /\/propagated-build-inputs$/) { - } elsif (-d $srcfile) { - # !!! hack for resolving name clashes - if (!-e $dstfile) { - mkdir $dstfile, 0755 || - die "error creating directory $dstfile"; - } - -d $dstfile or die "$dstfile is not a directory"; - createLinks($srcfile, $dstfile); - } elsif (-l $dstfile) { - my $target = readlink($dstfile); - die "collission between $srcfile and $target"; - } else { -# print "linking $dstfile to $srcfile\n"; - symlink($srcfile, $dstfile) || - die "error creating link $dstfile"; - } - } -} - -my %done; - -sub addPkg { - my $pkgdir = shift; - - return if (defined $done{$pkgdir}); - $done{$pkgdir} = 1; - -# print "merging $pkgdir\n"; - - createLinks("$pkgdir", "$selfdir"); - -# if (-f "$pkgdir/envpkgs") { -# my $envpkgs = `cat $pkgdir/envpkgs`; -# chomp $envpkgs; -# my @envpkgs = split / +/, $envpkgs; -# foreach my $envpkg (@envpkgs) { -# addPkg($envpkg); -# } -# } -} - -my @args = split ' ', $ENV{"derivations"}; - -while (scalar @args > 0) { - my $drvpath = shift @args; - print "adding $drvpath\n"; - addPkg($drvpath); -} - -symlink($ENV{"manifest"}, "$selfdir/manifest") or die "cannot create manifest"; - diff --git a/corepkgs/buildenv/builder.pl.in b/corepkgs/buildenv/builder.pl.in new file mode 100755 index 000000000000..d9ff73e17d2a --- /dev/null +++ b/corepkgs/buildenv/builder.pl.in @@ -0,0 +1,72 @@ +#! @perl@ -w + +use strict; +use Cwd; + +my $selfdir = $ENV{"out"}; +mkdir "$selfdir", 0755 || die "error creating $selfdir"; + +# For each activated package, create symlinks. + +sub createLinks { + my $srcdir = shift; + my $dstdir = shift; + + my @srcfiles = glob("$srcdir/*"); + + foreach my $srcfile (@srcfiles) { + my $basename = $srcfile; + $basename =~ s/^.*\///g; # strip directory + my $dstfile = "$dstdir/$basename"; + if ($srcfile =~ /\/propagated-build-inputs$/) { + } elsif (-d $srcfile) { + # !!! hack for resolving name clashes + if (!-e $dstfile) { + mkdir $dstfile, 0755 || + die "error creating directory $dstfile"; + } + -d $dstfile or die "$dstfile is not a directory"; + createLinks($srcfile, $dstfile); + } elsif (-l $dstfile) { + my $target = readlink($dstfile); + die "collission between $srcfile and $target"; + } else { +# print "linking $dstfile to $srcfile\n"; + symlink($srcfile, $dstfile) || + die "error creating link $dstfile"; + } + } +} + +my %done; + +sub addPkg { + my $pkgdir = shift; + + return if (defined $done{$pkgdir}); + $done{$pkgdir} = 1; + +# print "merging $pkgdir\n"; + + createLinks("$pkgdir", "$selfdir"); + +# if (-f "$pkgdir/envpkgs") { +# my $envpkgs = `cat $pkgdir/envpkgs`; +# chomp $envpkgs; +# my @envpkgs = split / +/, $envpkgs; +# foreach my $envpkg (@envpkgs) { +# addPkg($envpkg); +# } +# } +} + +my @args = split ' ', $ENV{"derivations"}; + +while (scalar @args > 0) { + my $drvpath = shift @args; + print "adding $drvpath\n"; + addPkg($drvpath); +} + +symlink($ENV{"manifest"}, "$selfdir/manifest") or die "cannot create manifest"; + diff --git a/scripts/nix-collect-garbage.in b/scripts/nix-collect-garbage.in index a3ee7bd5ee33..c701ad482f00 100755 --- a/scripts/nix-collect-garbage.in +++ b/scripts/nix-collect-garbage.in @@ -1,4 +1,4 @@ -#! /usr/bin/perl -w +#! @perl@ -w use strict; use IPC::Open2; diff --git a/scripts/nix-install-package.in b/scripts/nix-install-package.in index c71a6ca5fdee..73afead7d825 100644 --- a/scripts/nix-install-package.in +++ b/scripts/nix-install-package.in @@ -1,4 +1,4 @@ -#! /usr/bin/perl -w +#! @perl@ -w use strict; use POSIX qw(tmpnam); diff --git a/scripts/nix-prefetch-url.in b/scripts/nix-prefetch-url.in index 6cc3b7a26706..d921e922b589 100644 --- a/scripts/nix-prefetch-url.in +++ b/scripts/nix-prefetch-url.in @@ -1,4 +1,4 @@ -#! /usr/bin/perl -w +#! @perl@ -w use strict; use IPC::Open2; diff --git a/scripts/nix-pull.in b/scripts/nix-pull.in index 2b2d4e857ab5..acb4c0732623 100644 --- a/scripts/nix-pull.in +++ b/scripts/nix-pull.in @@ -1,4 +1,4 @@ -#! /usr/bin/perl -w -I@libexecdir@/nix +#! @perl@ -w -I@libexecdir@/nix use strict; use IPC::Open2; diff --git a/scripts/nix-push.in b/scripts/nix-push.in index 356fe1952207..167d787b759c 100644 --- a/scripts/nix-push.in +++ b/scripts/nix-push.in @@ -1,4 +1,4 @@ -#! /usr/bin/perl -w +#! @perl@ -w use strict; use POSIX qw(tmpnam); diff --git a/substitute.mk b/substitute.mk index 6882393bc89d..73a93963f192 100644 --- a/substitute.mk +++ b/substitute.mk @@ -9,6 +9,7 @@ -e "s^@storedir\@^$(storedir)^g" \ -e "s^@system\@^$(system)^g" \ -e "s^@wget\@^$(wget)^g" \ + -e "s^@perl\@^$(perl)^g" \ -e "s^@version\@^$(VERSION)^g" \ < $< > $@ || rm $@ if test -x $<; then chmod +x $@; fi -- cgit 1.4.1