Skip to content

Instantly share code, notes, and snippets.

@Koncord
Created February 21, 2017 14:34
Show Gist options
  • Select an option

  • Save Koncord/e0a6aa64c86ec34899b8ef260885ee1e to your computer and use it in GitHub Desktop.

Select an option

Save Koncord/e0a6aa64c86ec34899b8ef260885ee1e to your computer and use it in GitHub Desktop.
Build luasql
#################################################
export sqlitever=3150200
export luatarget=linux #linux mingw
export luasqltargets="sqlite3 mysql"
#################################################
git clone https://github.com/keplerproject/luasql
mkdir -p downloads
export BUILD_DIR=$(pwd)/build
export SQLITE3_DIR=$BUILD_DIR/sqlite3
mkdir -p $SQLITE3_DIR
#download and unpack lua & sqlite3
cd downloads
curl -R -O https://www.lua.org/ftp/lua-5.1.5.tar.gz
tar zxf lua-5.1.5.tar.gz
curl -R -O https://sqlite.org/2016/sqlite-amalgamation-$sqlitever.zip
unzip -o sqlite-amalgamation-$sqlitever.zip
cp sqlite-amalgamation-$sqlitever/sqlite3.c sqlite-amalgamation-$sqlitever/sqlite3.h $BUILD_DIR/sqlite3
#build lua
cd lua-5.1.5
make INSTALL_TOP=$BUILD_DIR $luatarget install
#build luasql
cd ../../luasql
make LUA_INC=$BUILD_DIR/include LUA_LIBDIR=$BUILD_DIR/lib LUA_SYS_VER=5.1 \
DRIVER_LIBS_sqlite3=$SQLITE3_DIR/sqlite3.c DRIVER_INCS_sqlite3=-I$SQLITE3_DIR \
PREFIX=$BUILD_DIR LIB_OPTION="-shared -pthread" $luasqltargets install
# test
cd ..
echo "You should see SQL version:"
echo "package.cpath = ';./build/lib/?.so'; print ((require \"luasql.sqlite3\")._VERSION)" | lua
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment