diff options
author | 2012-06-04 09:21:22 +0000 | |
---|---|---|
committer | 2012-06-04 09:21:22 +0000 | |
commit | 3f8d467aedc19236d027464cccd19ac96a0f10bc (patch) | |
tree | c33b0fe9eab9029af3cd690f4985b95a1aeb0836 /lib/libsqlite3 | |
parent | Rounding up a number of bytes in a bignum returned by the BN_num_bytes() (diff) | |
download | wireguard-openbsd-3f8d467aedc19236d027464cccd19ac96a0f10bc.tar.xz wireguard-openbsd-3f8d467aedc19236d027464cccd19ac96a0f10bc.zip |
stop editing header by hand, expose script I'm going to use for next versions
Diffstat (limited to 'lib/libsqlite3')
-rw-r--r-- | lib/libsqlite3/Makefile | 6 | ||||
-rw-r--r-- | lib/libsqlite3/tsrc/header_regen | 41 |
2 files changed, 46 insertions, 1 deletions
diff --git a/lib/libsqlite3/Makefile b/lib/libsqlite3/Makefile index 23d4cc3a707..3b01e1659ea 100644 --- a/lib/libsqlite3/Makefile +++ b/lib/libsqlite3/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.6 2012/06/04 09:09:38 espie Exp $ +# $OpenBSD: Makefile,v 1.7 2012/06/04 09:21:22 espie Exp $ .include <bsd.own.mk> @@ -102,6 +102,10 @@ includes: ${INSTALL} ${INSTALL_COPY} -m 444 ${.CURDIR}/src/$$i ${DESTDIR}/usr/include/$$i; \ done +.PHONY: header +header: + cd ${.CURDIR} && perl tsrc/header_regen VERSION src/sqlite.h.in src/sqlite3.h + .include <bsd.lib.mk> ${OBJS} ${GOBJS} ${POBJS} ${SOBJS}: opcodes.h parse.h 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"; + } +} |