sqlite: Add hack for 32-bit to properly get address of SetDllDirectoryW

This commit is contained in:
Alexpux
2014-11-08 22:33:03 +03:00
parent 3a181c50a9
commit 690efeaada
4 changed files with 71 additions and 29 deletions

View File

@@ -5,7 +5,7 @@ pkgname=('sqlite' 'libsqlite' 'libsqlite-devel' 'sqlite-doc')
_amalgamationver=3080701
_docver=${_amalgamationver}
pkgver=3.8.7.1
pkgrel=1
pkgrel=2
pkgdesc="A C library that implements an SQL database engine"
arch=('i686' 'x86_64')
license=('custom:Public Domain')
@@ -17,19 +17,28 @@ source=( # tarball containing the amalgamation for SQLite >= 3.7.5 together with
http://www.sqlite.org/2014/sqlite-doc-${_docver}.zip
license.txt
'sqlite-3.8.0.1-msys2.patch'
'sqlite3-3.8.7.1-1.src.patch')
options=('!libtool' '!emptydirs')
'sqlite3-3.8.7.1-1.src.patch'
'sqlite3-cygwin-msys.patch'
'getproc-hack.patch')
options=('!libtool' '!emptydirs' '!debug' 'strip')
sha1sums=('5601be1263842209d7c5dbf6128f1cc0b6bbe2e5'
'712b4ce64317646f27a046d5850515cd710bd00a'
'f34f6daa4ab3073d74e774aad21d66878cf26853'
'f357145f11da54b3dfd9c45e594d93960af87105'
'e3bd22d9906e1b94b1bf84ec3a6c3907f2183182')
'4d7565aa6b7ce75fcdbd6f67cbfdfa05f5aea486'
'69b3f261aae4990d23daa14ca0d2f0c8b53fb423'
'6dcfcc8c994ee5412395e5cba4933bddf9e2f6b7')
prepare() {
cd "$srcdir"/sqlite-autoconf-$_amalgamationver
patch -p2 -i ${srcdir}/sqlite3-3.8.7.1-1.src.patch
patch -p1 -i ${srcdir}/sqlite3-cygwin-msys.patch
patch -p1 -i ${srcdir}/sqlite-3.8.0.1-msys2.patch
if [ "${CARCH}" = "i686" ]; then
patch -p1 -i ${srcdir}/getproc-hack.patch
fi
autoreconf -fi
}
@@ -53,26 +62,20 @@ build() {
-DSQLITE_WIN32_MAX_PATH_BYTES=4096 \
-DUSE_SYSTEM_SQLITE=1"
# build sqlite
cd "$srcdir"/sqlite-autoconf-$_amalgamationver
./configure \
--prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--build=${CHOST} \
--enable-shared \
--enable-static
make
make DESTDIR=${srcdir}/dest install
# build the tcl extension
#cd "$srcdir"/sqlite-autoconf-$_amalgamationver/tea
#./configure --prefix=/usr \
#--with-system-sqlite
#make
make
make DESTDIR=${srcdir}/dest install
}
package_sqlite() {
pkgdesc="A C library that implements an SQL database engine"
depends=('libreadline' 'libsqlite')
provides=("sqlite3=$pkgver")
@@ -86,8 +89,7 @@ package_sqlite() {
}
package_libsqlite() {
pkgdesc="sqlite library"
pkgdesc="Sqlite3 library"
groups=('libraries')
mkdir -p ${pkgdir}/usr/bin
@@ -95,11 +97,10 @@ package_libsqlite() {
}
package_libsqlite-devel() {
pkgdesc="sqlite headers and libraries"
pkgdesc="Sqlite3 headers and libraries"
groups=('development')
depends=("libsqlite=${pkgver}")
options=('staticlibs')
options+=('staticlibs')
mkdir -p ${pkgdir}/usr
cp -rf ${srcdir}/dest/usr/include ${pkgdir}/usr/
@@ -107,11 +108,10 @@ package_libsqlite-devel() {
}
package_sqlite-doc() {
pkgdesc="most of the static HTML files that comprise this website, including all of the SQL Syntax and the C/C++ interface specs and other miscellaneous documentation"
#arch=('any') - not yet supported
provides=("sqlite3-doc=$pkgver")
replaces=("sqlite3-doc")
pkgdesc="Most of the static HTML files that comprise this website, including all of the SQL Syntax and the C/C++ interface specs and other miscellaneous documentation"
#arch=('any') - not yet supported
provides=("sqlite3-doc=$pkgver")
replaces=("sqlite3-doc")
#cd ${srcdir}/sqlite-doc-${_amalgamationver}
cd ${srcdir}/sqlite-doc-${_docver}

21
sqlite/getproc-hack.patch Normal file
View File

@@ -0,0 +1,21 @@
--- sqlite-autoconf-3080701/sqlite3.c.orig 2014-11-08 12:11:35.808800000 +0300
+++ sqlite-autoconf-3080701/sqlite3.c 2014-11-08 12:14:39.748400000 +0300
@@ -38546,9 +38546,17 @@
#if !defined(SQLITE_OMIT_LOAD_EXTENSION)
if( cygwin_conv_path ){
WCHAR buf[MAX_PATH];
+ BOOL WINAPI (*set_dll_directory)(LPCWSTR);
cygwin_conv_path(CCP_POSIX_TO_WIN_W, "/usr/bin",
buf, MAX_PATH*sizeof(WCHAR));
- osSetDllDirectoryW(buf);
+ HMODULE k32 = GetModuleHandleW (L"kernel32.dll");
+ if (k32)
+ set_dll_directory = (BOOL WINAPI (*)(LPCWSTR)) GetProcAddress (k32, "SetDllDirectoryW");
+ if (!set_dll_directory)
+ set_dll_directory = (BOOL WINAPI (*)(LPCWSTR)) -1;
+ else
+ set_dll_directory (buf);
+ //osSetDllDirectoryW(buf);
#ifdef _WIN32
}else if( cygwin_conv_to_full_win32_path ){
WCHAR buf[MAX_PATH];

View File

@@ -11405,7 +11405,7 @@
if( pzErrMsg ) *pzErrMsg = 0;
@@ -100426,14 +100945,30 @@ static int sqlite3LoadExtension(
@@ -100426,14 +100945,26 @@ static int sqlite3LoadExtension(
zEntry = zProc ? zProc : "sqlite3_extension_init";
handle = sqlite3OsDlOpen(pVfs, zFile);
@@ -11426,11 +11426,7 @@
+ sqlite3_free(zAltFile);
+ }
+ if( handle==0 ){
+#ifdef __MSYS__
+ zAltFile = sqlite3_mprintf("msys-sqlite3%s-0.%s", zFile, azEnding);
+#else
+ zAltFile = sqlite3_mprintf("cygsqlite3%s-0.%s", zFile, azEnding);
+#endif
+ if( zAltFile==0 ) return SQLITE_NOMEM;
+ handle = sqlite3OsDlOpen(pVfs, zAltFile);
+ sqlite3_free(zAltFile);

View File

@@ -0,0 +1,25 @@
diff -Naur sqlite-autoconf-3080701-orig/sqlite3.c sqlite-autoconf-3080701/sqlite3.c
--- sqlite-autoconf-3080701-orig/sqlite3.c 2014-11-08 20:34:01.593800000 +0300
+++ sqlite-autoconf-3080701/sqlite3.c 2014-11-08 20:37:42.146600000 +0300
@@ -38527,7 +38527,7 @@
#ifdef _WIN32
module = osGetModuleHandleW(L"CYGWIN1.DLL");
if( !module){
- module = osGetModuleHandleW(L"MSYS-1.0.DLL");
+ module = osGetModuleHandleW(L"MSYS-2.0.DLL");
}
if( module ){
for( i=78; i<ArraySize(aSyscall); ++i ){
@@ -100964,6 +100964,12 @@
handle = sqlite3OsDlOpen(pVfs, zAltFile);
sqlite3_free(zAltFile);
}
+ if( handle==0 ){
+ zAltFile = sqlite3_mprintf("msys-sqlite3%s-0.%s", zFile, azEnding);
+ if( zAltFile==0 ) return SQLITE_NOMEM;
+ handle = sqlite3OsDlOpen(pVfs, zAltFile);
+ sqlite3_free(zAltFile);
+ }
#endif
}
if( handle==0 ){