Actions

Difference between revisions of "Sqlite"

From RonWareWiki

(New page: I use the excellent [http://sqlite.org/index.html SQLite] relational database for all sorts of projects. My vim setup as well as my [http://ronware.org/reva/ Reva Forth] utilize it. ...)
 
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
[[category: tools]]
 +
 
I use the excellent [http://sqlite.org/index.html SQLite] relational database for all sorts of projects.  My [[vim]] setup as well as my [http://ronware.org/reva/ Reva Forth] utilize it.
 
I use the excellent [http://sqlite.org/index.html SQLite] relational database for all sorts of projects.  My [[vim]] setup as well as my [http://ronware.org/reva/ Reva Forth] utilize it.
  
Line 5: Line 7:
 
<code language="bash">
 
<code language="bash">
 
#!/bin/sh
 
#!/bin/sh
 +
# vim: ft=sh :
 +
# PATH includes $(HOME)/mingw/bin
 +
 +
tarfile=`ls -t sqlite*.tar.gz|head -n 1`
 +
tardir=`echo ${tarfile}|sed -e's/.tar.gz//'|sed -e's/amalgamation-//'`
 +
 +
die() {
 +
echo "$2"
 +
exit $1
 +
}
  
tarfile=`ls -t sqlite*.tar.gz|head -n 1`
+
oldpwd=`pwd`  
tardir=`echo ${tarfile}|sed -e's/.tar.gz//'`
 
  
if [ "$tardir" == "" ]
+
if [ "$tardir" != "" ]
 
then
 
then
# no tar directory
 
echo "We are presumably in the tar directory already"
 
pushd .
 
else
 
 
# unpack the tar
 
# unpack the tar
 
tar xzvf $tarfile
 
tar xzvf $tarfile
pushd $tardir
+
cd $tardir
 
fi
 
fi
  
if configure --disable-tcl --enable-threadsafe CFLAGS="-O3 -s"  
+
if [ ! -f "sqlite3.pc.in" ]
 
then
 
then
echo "Building SQLITE"
+
die 3 "This doesn't appear to be a SQLite distribution directory"
if  gmake sqlite3.dll
 
then
 
upx --best sqlite3.dll
 
cp sqlite3.dll /c/rw/vim7/bin/sqlite3.dll
 
cp sqlite3.dll /c/rw/reva/bin/sqlite3.dll
 
else
 
echo "Could not build the DLL, sorry."
 
fi
 
else
 
echo "Could not configure, sorry."
 
 
fi
 
fi
  
popd
+
(
 +
export PATH=~/mingw/i686-pc-mingw32/bin:$PATH
 +
./configure --host=i686-pc-mingw32 --enable-threadsafe CFLAGS="-O3 -s -mtune=i686 -fomit-frame-pointer -fmerge-all-constants" \
 +
|| die 1 "Could not configure, sorry."
 +
 
 +
echo "Building SQLITE"
 +
 
 +
make || die 2 "Could not build the DLL, sorry."
 +
 
 +
i686-pc-mingw32-gcc -shared -o sqlite3.dll sqlite3.o
 +
i686-pc-mingw32-strip sqlite3.dll
 +
upx --best sqlite3.dll
 +
)
 +
 +
cd $oldpwd
  
 
</code>
 
</code>

Latest revision as of 08:53, 8 December 2009


I use the excellent SQLite relational database for all sorts of projects. My vim setup as well as my Reva Forth utilize it.

Here is a script I created to help me rebuild SQLite as new versions are available. The script runs on Windows using the 'MSys' bash shell:

  1. !/bin/sh
  2. vim: ft=sh :
  3. PATH includes $(HOME)/mingw/bin

tarfile=`ls -t sqlite*.tar.gz|head -n 1` tardir=`echo ${tarfile}|sed -e's/.tar.gz//'|sed -e's/amalgamation-//'`

die() { echo "$2" exit $1 }

oldpwd=`pwd`

if [ "$tardir" != "" ] then # unpack the tar tar xzvf $tarfile cd $tardir fi

if [ ! -f "sqlite3.pc.in" ] then die 3 "This doesn't appear to be a SQLite distribution directory" fi

( export PATH=~/mingw/i686-pc-mingw32/bin:$PATH ./configure --host=i686-pc-mingw32 --enable-threadsafe CFLAGS="-O3 -s -mtune=i686 -fomit-frame-pointer -fmerge-all-constants" \ || die 1 "Could not configure, sorry."

echo "Building SQLITE"

make || die 2 "Could not build the DLL, sorry."

i686-pc-mingw32-gcc -shared -o sqlite3.dll sqlite3.o i686-pc-mingw32-strip sqlite3.dll upx --best sqlite3.dll )

cd $oldpwd