From 19e7202b8a487769e2965b9b8f7148da39bf9504 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sun, 7 Feb 2010 21:28:11 -0800 Subject: [PATCH 1/1] Start working on PSPP build script. --- .gitignore | 1 + build-pspp | 144 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 145 insertions(+) create mode 100644 .gitignore create mode 100755 build-pspp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..913ec74c53 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/builds/ diff --git a/build-pspp b/build-pspp new file mode 100755 index 0000000000..7c60f22d7f --- /dev/null +++ b/build-pspp @@ -0,0 +1,144 @@ +#! /usr/bin/env perl + +use Getopt::Long qw(:config bundling no_ignore_case); +use POSIX; + +use strict; +use warnings; + +my $help = 0; +GetOptions ("h|help" => \$help); + +usage () if $help; + +die "$0: exactly one or two nonoption arguments are required\n" + if @ARGV != 1 && @ARGV != 2; + +my $buildslave = `hostname`; +chomp $buildslave; + +# Select build number. +my $buildnumber = POSIX::strftime("%Y%m%d%H%M%S", localtime); +print "\tBUILDNUMBER=$buildnumber\n"; + +# Create build directory. +my $builddir = "builds/$buildnumber"; +print "Create $builddir\n"; +mkdir "builds" or die "builds: mkdir: $!\n" if ! -d "builds"; +mkdir $builddir or die "$builddir: mkdir: $!\n"; + +if (@ARGV == 2) { + my ($repo, $branch) = @ARGV; + + # Fetch branch + print "Fetch $repo, branch $branch\n"; + run ("git fetch $repo +$branch:buildtmp/$$/pspp"); + + # Get revision number. + my $revision = `git rev-parse buildtmp/$$/pspp`; + chomp $revision; + print "\tREVISION=$revision\n"; + my $abbrev_revision = substr ($revision, 0, 6); + + # Extract source. + print "Extract branch into $builddir/pspp$buildnumber\n"; + run ("git archive --format=tar --prefix=pspp$buildnumber/ buildtmp/$$/pspp | (cd $builddir && tar xf -)"); + + # Extract version number. + print "Extract version number\n"; + my $trace = `cd $builddir/pspp$buildnumber && autoconf -t AC_INIT`; + chomp $trace; + my ($file, $line, $macro, $package, $version, @rest) = split (':', $trace); + print "\tVERSION=$version\n"; + + # Append -g012345 to AC_INIT version number. + my $fullname = "$builddir/pspp$buildnumber/$file"; + open (OLDFILE, '<', $fullname) + or die "opening $fullname failed: $!\n"; + open (NEWFILE, '>', "$fullname.new") + or die "creating $fullname.new failed: $!\n"; + while () { + if ($. != $line) { + print NEWFILE $_; + } else { + print NEWFILE "AC_INIT([[$package]]"; + print NEWFILE ", [[$version-g$abbrev_revision]]"; + print NEWFILE ", [[$_]]" foreach @rest; + print NEWFILE ")\n"; + } + } + close (NEWFILE); + close (OLDFILE); + rename ("$fullname.new", $fullname) + or die "rename $fullname.new to $fullname failed: $!\n"; + + # Add note to beginning of NEWS (otherwise "make dist" fails). + $fullname = "$builddir/pspp$buildnumber/NEWS"; + open (OLDFILE, '<', $fullname) + or die "opening $fullname failed: $!\n"; + open (NEWFILE, '>', "$fullname.new") + or die "creating $fullname.new failed: $!\n"; + my $found_changes = 0; + while () { + if (!$found_changes && /^Changes/) { + $found_changes = 1; + print NEWFILE <> 8; + } + exit 1; +} + +# Clone source +# Add build number +# Tag build +# Clone gnulib at correct commit number +# Run gnulib-tool. +# Run configure +# Make dist + +# Unpack dist +# Run configure +# Check +# Install +# Make binary dist +# Build mingw32 installer +# Other distcheck stuff? -- 2.30.2