Actions

Difference between revisions of "Sqlite"

From RonWareWiki

 
Line 8: Line 8:
 
#!/bin/sh
 
#!/bin/sh
 
# vim: ft=sh :  
 
# vim: ft=sh :  
 +
# PATH includes $(HOME)/mingw/bin
 
   
 
   
 
tarfile=`ls -t sqlite*.tar.gz|head -n 1`
 
tarfile=`ls -t sqlite*.tar.gz|head -n 1`
 
tardir=`echo ${tarfile}|sed -e's/.tar.gz//'|sed -e's/amalgamation-//'`
 
tardir=`echo ${tarfile}|sed -e's/.tar.gz//'|sed -e's/amalgamation-//'`
+
 
if [ "$tardir" == "" ]
+
die() {
 +
echo "$2"
 +
exit $1
 +
}
 +
 
 +
oldpwd=`pwd`
 +
 
 +
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 [ ! -f "sqlite3.pc.in" ]
export PATH=~/mingw/i386-mingw32msvc/bin:$PATH
 
if ./configure --host=i386-mingw32msvc --enable-threadsafe CFLAGS="-O3 -s -mtune=i686 -fomit-frame-pointer -fmerge-all-constants"  
 
 
then
 
then
echo "Building SQLITE"
+
die 3 "This doesn't appear to be a SQLite distribution directory"
if  make
 
then
 
i386-mingw32msvc-gcc -shared -o sqlite3.dll sqlite3.o
 
i386-mingw32msvc-strip sqlite3.dll
 
upx --best sqlite3.dll
 
else
 
echo "Could not build the DLL, sorry."
 
fi
 
else
 
echo "Could not configure, sorry."
 
 
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
 
)
 
)
 
   
 
   
popd
+
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