Difference between revisions of "Sqlite"
From RonWareWiki
(One intermediate revision by the same user not shown) | |||
Line 7: | 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 | ||
+ | } | ||
+ | |||
+ | oldpwd=`pwd` | ||
− | if [ "$tardir" | + | if [ "$tardir" != "" ] |
then | then | ||
− | |||
− | |||
− | |||
− | |||
# unpack the tar | # unpack the tar | ||
tar xzvf $tarfile | tar xzvf $tarfile | ||
− | + | cd $tardir | |
fi | fi | ||
− | if | + | if [ ! -f "sqlite3.pc.in" ] |
then | then | ||
− | + | die 3 "This doesn't appear to be a SQLite distribution directory" | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
fi | 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 | ||
</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:
- !/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
}
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