On 2016/06/08 19:01, James Turner wrote:
> I prefer option 2. Switch to the amalgamation with our changes on top.

I've been looking at this. I don't really like any of the options
but this seems the "least worst" one. I'm not terribly happy about
this, but I don't see what else we can really do at present.

Current version of this diff is a horrendous 480K lines / 17MB
uncompressed, so it's at https://junkpile.org/sqlite-3.11.0.diff.gz
rather than in this mail, and I am just starting a ports build
with it.

It was constructed like this:

- Remove the old source files and tools

- Extract verbatim sqlite 3.11.0 from upstream,
https://www.sqlite.org/2016/sqlite-amalgamation-3110000.zip

- Add the local arc4random patch

- Adjust Makefile (diff for this is below, and also in the above
gzipped diff).

At least the library size has dropped by a decent amount by doing
this, from 3.7M to 3.0M (amd64).

> > > > With this the main file is unfortunately huge but would be easier
> > > > by far to update later. Note that we only have a small change to
> > > > the actual source code (replacing the RNG code) which is easy enough
> > > > to carry across. Most of our changes are to the build infrastructure.

Turns out I forgot about the pthread stubs, without which there
are build failures in mandoc and various ports things unless we link
them with -lpthread. This broke a few things in my first ports test
build, but thanks to guenther's work it should now be valid to pull
this in via an inter-library dependency rather than having to
sprinkle it over mandoc and lots of the ports tree.

Index: Makefile
===================================================================
RCS file: /cvs/src/lib/libsqlite3/Makefile,v
retrieving revision 1.15
diff -u -p -r1.15 Makefile
--- Makefile    12 Sep 2015 02:08:34 -0000      1.15
+++ Makefile    21 Jun 2016 22:52:47 -0000
@@ -2,40 +2,10 @@
 
 .include <bsd.own.mk>
 
-.if defined(NOPIC)
-CPPFLAGS +=    -DSQLITE_OMIT_LOAD_EXTENSION=1
-.endif
-
-CPPFLAGS +=    -I${.OBJDIR} -I${.CURDIR}/tsrc -I${.CURDIR}/src \
-               -I${.CURDIR}/ext/rtree -I${.CURDIR}/ext/fts3
 LIB = sqlite3
 
-.PATH: ${.CURDIR}/tsrc ${.CURDIR}/src ${.CURDIR}/ext/fts3 ${.CURDIR}/ext/rtree
-
-SRCS = alter.c analyze.c attach.c auth.c \
-       backup.c bitvec.c btmutex.c btree.c build.c \
-       callback.c complete.c ctime.c date.c dbstat.c delete.c \
-       expr.c fault.c fkey.c \
-       fts3.c fts3_aux.c fts3_expr.c fts3_hash.c fts3_icu.c fts3_porter.c \
-       fts3_snippet.c fts3_tokenize_vtab.c fts3_tokenizer.c fts3_tokenizer1.c \
-       fts3_unicode.c fts3_unicode2.c fts3_write.c \
-       func.c global.c hash.c \
-       insert.c journal.c legacy.c loadext.c \
-       main.c malloc.c mem1.c \
-       memjournal.c \
-       mutex.c mutex_noop.c mutex_unix.c \
-       notify.c opcodes.c os.c os_unix.c \
-       pager.c parse.c pcache.c pcache1.c pragma.c prepare.c printf.c \
-       random.c resolve.c rowset.c rtree.c select.c status.c \
-       table.c threads.c tokenize.c treeview.c trigger.c \
-       update.c util.c vacuum.c \
-       vdbe.c vdbeapi.c vdbeaux.c vdbeblob.c vdbemem.c vdbesort.c \
-       vdbetrace.c wal.c walker.c where.c wherecode.c whereexpr.c utf.c vtab.c
-
-# so that it works with NO THREADS
-SRCS +=        pthread_stub.c
-
-#      mem3.c mem5.c
+SRCS = sqlite3.c
+LDADD =        -lpthread
 
 FEATURE_FLAGS =        -DSQLITE_ENABLE_COLUMN_METADATA \
                -DSQLITE_ENABLE_RTREE \
@@ -62,55 +32,14 @@ CPPFLAGS +=         $(FEATURE_FLAGS) -DSQLITE_T
 
 FILES = sqlite3.h sqlite3ext.h
 
-opcodes.c: opcodes.h ${.CURDIR}/mkopcodec.awk
-       sort -n -b -k 3 opcodes.h | awk -f ${.CURDIR}/mkopcodec.awk >opcodes.c
-
-
-opcodes.h: parse.h ${.CURDIR}/src/vdbe.c \
-    ${.CURDIR}/mkopcodeh.awk
-       cat parse.h ${.CURDIR}/src/vdbe.c | \
-           awk -f ${.CURDIR}/mkopcodeh.awk >$@
-
-beforedepend: opcodes.h keywordhash.h
-
-keywordhash.h: mkkeywordhash
-       ${.OBJDIR}/mkkeywordhash >$@
-
-mkkeywordhash: tool/mkkeywordhash.c
-       ${HOSTCC} ${LDSTATIC} -o $@ $< ${LDADD}
-
-lemon: tool/lemon.c
-       ${HOSTCC} ${LDSTATIC} -o $@ $< ${LDADD}
-
-parse.c: parse.y lemon
-       ln -sf ${.CURDIR}/src/parse.y
-       ln -sf ${.CURDIR}/src/lempar.c # XXX tweaked parser
-       ${.OBJDIR}/lemon ${FEATURE_FLAGS} parse.y
-       mv parse.h parse.h.temp
-       awk -f ${.CURDIR}/addopcodes.awk parse.h.temp >parse.h
-       rm parse.h.temp
-
-parse.h: parse.c
-
-tokenize.o tokenize.po tokenize.so: keywordhash.h
-
-CLEANFILES += mkkeywordhash opcodes.c opcodes.h keywordhash.h \
-       parse.* lemon lempar.c
-       
 beforeinstall:
        ${INSTALL} ${INSTALL_COPY} -o root -g ${SHAREGRP} \
            -m ${SHAREMODE} ${.CURDIR}/sqlite3.pc ${DESTDIR}/usr/lib/pkgconfig/
 
 includes:
        @for i in ${FILES}; do \
-           cmp -s ${.CURDIR}/src/$$i ${DESTDIR}/usr/include/$$i || \
-               ${INSTALL} ${INSTALL_COPY} -m 444 ${.CURDIR}/src/$$i 
${DESTDIR}/usr/include/$$i; \
+           cmp -s ${.CURDIR}/$$i ${DESTDIR}/usr/include/$$i || \
+               ${INSTALL} ${INSTALL_COPY} -m 444 ${.CURDIR}/$$i 
${DESTDIR}/usr/include/$$i; \
        done
 
-.PHONY: header
-header:
-       cd ${.CURDIR} && perl tsrc/header_regen VERSION src/sqlite.h.in 
src/sqlite3.h sqlite3.pc.in sqlite3.pc
-
 .include <bsd.lib.mk>
-
-${OBJS} ${GOBJS} ${POBJS} ${SOBJS}: opcodes.h parse.h

Reply via email to