diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2012-06-04 09:21:23 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2012-06-04 09:21:23 +0000 |
commit | 4388e87c1f688ad1a06e92358401401b539d2476 (patch) | |
tree | 8682cd7ef32d6b9490ed1dc3c77a6adcd72b5503 /lib/libsqlite3/tsrc | |
parent | 21b840ac961a36637ce261f3eb5bdd979ae968dd (diff) |
stop editing header by hand, expose script I'm going to use for next versions
Diffstat (limited to 'lib/libsqlite3/tsrc')
-rw-r--r-- | lib/libsqlite3/tsrc/header_regen | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/libsqlite3/tsrc/header_regen b/lib/libsqlite3/tsrc/header_regen new file mode 100644 index 00000000000..97663506067 --- /dev/null +++ b/lib/libsqlite3/tsrc/header_regen @@ -0,0 +1,41 @@ +#! /usr/bin/perl +# Written by Marc Espie 2012, Public Domain +use strict; +use warnings; + +@ARGV == 3 or + die "Usage: $0 version src dest\n"; + +my ($vfname, $src, $dest) = @ARGV; +open(my $fh, '<', $vfname) + or die "Can't read $vfname: $!\n"; +my $version = <$fh>; +chomp $version; +my @l = split(/\./, $version); +my $v2 = sprintf("%d%03d%03d", @l); + +open(my $in, '<', $src) + or die "Can't read $src: $!\n"; +open(my $out, '>', $dest) + or die "Can't write to $dest: $!\n"; + +select($out); + +while (<$in>) { + s/\-\-VERS\-\-/$version/; + s/\-\-VERSION\-NUMBER\-\-/$v2/; + s/\-\-SOURCE\-ID\-\-/OpenBSD/; + + if (m/^\#ifdef\s+SQLITE_INT64_TYPE/) { + while(<$in>) { + last if m/^\#endif/; + } + print "typedef int64_t sqlite_int64;\n"; + print "typedef uint64_t sqlite_uint64;\n"; + } else { + print $_; + } + if (m/^\#\s*include\s*\<stdarg\.h\>/) { + print "#include <stdint.h>\n"; + } +} |