aboutsummaryrefslogtreecommitdiff
path: root/bootstrap
diff options
context:
space:
mode:
Diffstat (limited to 'bootstrap')
-rwxr-xr-x[-rw-r--r--]bootstrap92
1 files changed, 85 insertions, 7 deletions
diff --git a/bootstrap b/bootstrap
index 1726aea..723788f 100644..100755
--- a/bootstrap
+++ b/bootstrap
@@ -1,8 +1,86 @@
#!/bin/sh
-set e
-test -d m4 || mkdir m4
-test -d gdbm || mkdir gdbm
-git submodule init
-git submodule update
-git submodule foreach ./bootstrap
-autoreconf -f -i -s
+#! -*- perl -*-
+eval 'exec perl -x -S $0 ${1+"$@"}'
+ if 0;
+
+use strict;
+use warnings;
+use File::Basename;
+
+my %target;
+
+die "no bootstrap.conf in current working directory\n"
+ unless -f "bootstrap.conf";
+
+# Read configuration
+open(my $fh, '<', 'bootstrap.conf')
+ or die "can't open bootstrap.conf: $!\n";
+my $i = 0;
+while (<$fh>) {
+ chomp;
+ s/^\s+//;
+ s/#.*$//;
+ next if /^$/ ;
+ my ($treeish, $subdir) = split /\s+/;
+ if (!$subdir) {
+ $subdir = basename($treeish);
+ }
+
+ if ($subdir ne "master") {
+ unless (-d "gdbm/$subdir") {
+ system("git -C gdbm clone -b $treeish ./master $subdir");
+ }
+ }
+ system("(cd gdbm/$subdir; ./bootstrap)");
+
+ unless (-d "src/$subdir") {
+ mkdir "src/$subdir"
+ }
+ my $makefile = "src/$subdir/Makefile.am";
+ unless (-f $makefile) {
+ open(my $of, '>', $makefile)
+ or die "can't open $makefile for writing: $!\n";
+ print $of <<EOT;
+noinst_PROGRAMS=fetchkeys
+fetchkeys_SOURCES=fetchkeys.c
+VPATH=\$(top_srcdir)/src
+LDADD=../../gdbm/$subdir/src/.libs/libgdbm.a
+AM_CPPFLAGS=-DSIZEOF_OFF_T=8 -I\$(top_srcdir)/gdbm/$subdir/src/
+EOT
+ ;
+ close $of;
+ }
+ $target{$subdir} = {
+ order => $i,
+ treeish => $treeish
+ };
+ ++$i;
+}
+close($fh);
+
+#
+# Creating directories
+#
+unless (-d 'm4') {
+ mkdir 'm4'
+}
+unless (-d 'gdbm') {
+ mkdir 'gdbm'
+}
+
+system("git submodule init");
+system("git submodule update");
+
+#
+# Creating bootstrap.mk
+#
+my @k = sort { $target{$a}{order} <=> $target{$b}{order}} keys %target;
+my $gdbm_subdirs = join(' ', map { "gdbm/$_" } @k);
+open($fh, '>', 'bootstrap.mk')
+ or die "can't open bootstrap.mk: $!\n";
+print $fh "AC_SUBST([USER_SUBDIRS],['$gdbm_subdirs'])\n";
+print $fh "AC_SUBST([USER_TARGETS],['" . join(' ', @k) . "'])\n";
+print $fh "AC_CONFIG_SUBDIRS([$gdbm_subdirs])\n";
+print $fh "AC_CONFIG_FILES([" . join(' ', map { "src/$_/Makefile" } @k) . "])\n";
+close $fh;
+

Return to:

Send suggestions and report system problems to the System administrator.