1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303
|
#!/bin/sh
#
# Build script for cross compiling and packaging SQLite
# ODBC drivers and tools for Win32 using MinGW and NSIS.
# Tested on Fedora Core 3/5/8, Debian Etch, RHEL 5/6.
#
# Cross toolchain and NSIS for Linux/i386/x86_64 can be fetched from
# http://www.ch-werner.de/xtools/crossmingw64-0.3-1.i386.rpm
# http://www.ch-werner.de/xtools/crossmingw64-0.3-1.x86_64.rpm
# http://www.ch-werner.de/xtools/nsis-2.37-1.i386.rpm
# or
# http://www.ch-werner.de/xtools/crossmingw64-0.3.i386.tar.bz2
# http://www.ch-werner.de/xtools/crossmingw64-0.3.x86_64.tar.bz2
# http://www.ch-werner.de/xtools/nsis-2.37-1_i386.tar.gz
# Some aspects of the build process can be controlled by shell variables:
#
# NO_SQLITE2=1 omit building SQLite 2 and drivers for it
# NO_TCCEXT=1 omit building TCC extension
# WITH_SOURCES=1 add source directory to NSIS installer
# SQLITE_DLLS=1 build and package drivers with SQLite 2/3 DLLs
# SQLITE_DLLS=2 build drivers with refs to SQLite 2/3 DLLs
# SQLite3 driver can use System.Data.SQlite.dll
set -e
VER2=2.8.17
VER3=3.43.2
VER3X=3430200
VERZ=1.2.8
TCCVER=0.9.26
nov2=false
if test -n "$NO_SQLITE2" ; then
nov2=true
ADD_NSIS="-DWITHOUT_SQLITE2"
fi
notcc=false
if test -n "$NO_TCCEXT" ; then
notcc=true
ADD_NSIS="$ADD_NSIS -DWITHOUT_TCCEXT"
else
export SQLITE_TCC_DLL="sqlite+tcc.dll"
fi
if test -f "$WITH_SEE" ; then
export SEEEXT=see
ADD_NSIS="$ADD_NSIS -DWITH_SEE=$SEEEXT"
if test "$SQLITE_DLLS" = "2" ; then
SQLITE_DLLS=1
fi
fi
if test "$SQLITE_DLLS" = "2" ; then
# turn on -DSQLITE_DYNLOAD in sqlite3odbc.c
export ADD_CFLAGS="-DWITHOUT_SHELL=1 -DWITH_SQLITE_DLLS=2"
ADD_NSIS="$ADD_NSIS -DWITHOUT_SQLITE3_EXE"
elif test -n "$SQLITE_DLLS" ; then
export ADD_CFLAGS="-DWITHOUT_SHELL=1 -DWITH_SQLITE_DLLS=1"
export SQLITE3_DLL="-Lsqlite3 -lsqlite3"
export SQLITE3_EXE="sqlite3.exe"
ADD_NSIS="$ADD_NSIS -DWITH_SQLITE_DLLS"
else
export SQLITE3_A10N_O="sqlite3a10n.o"
export SQLITE3_EXE="sqlite3.exe"
fi
if test -n "$WITH_SOURCES" ; then
ADD_NSIS="$ADD_NSIS -DWITH_SOURCES"
fi
echo "=================="
echo "Preparing zlib ..."
echo "=================="
test -r zlib-${VERZ}.tar.gz || \
wget -c http://zlib.net/zlib-${VERZ}.tar.gz || exit 1
rm -rf zlib-${VERZ}
tar xzf zlib-${VERZ}.tar.gz
ln -sf zlib-${VERZ} zlib
echo "===================="
echo "Preparing sqlite ..."
echo "===================="
( $nov2 && echo '*** skipped (NO_SQLITE2)' ) || true
$nov2 || test -r sqlite-${VER2}.tar.gz || \
wget -c http://www.sqlite.org/sqlite-${VER2}.tar.gz \
--no-check-certificate
$nov2 || test -r sqlite-${VER2}.tar.gz || exit 1
$nov2 || rm -f sqlite
$nov2 || rm -rf sqlite-${VER2}
$nov2 || tar xzf sqlite-${VER2}.tar.gz
$nov2 || ln -sf sqlite-${VER2} sqlite
# enable sqlite_encode_binary et.al.
$nov2 || patch sqlite/main.mk <<'EOD'
--- sqlite.orig/main.mk 2005-04-24 00:43:23.000000000 +0200
+++ sqlite/main.mk 2006-03-16 14:29:55.000000000 +0100
@@ -55,7 +55,7 @@
# Object files for the SQLite library.
#
LIBOBJ = attach.o auth.o btree.o btree_rb.o build.o copy.o date.o delete.o \
- expr.o func.o hash.o insert.o \
+ expr.o func.o hash.o insert.o encode.o \
main.o opcodes.o os.o pager.o parse.o pragma.o printf.o random.o \
select.o table.o tokenize.o trigger.o update.o util.o \
vacuum.o vdbe.o vdbeaux.o where.o tclsqlite.o
EOD
# display encoding
$nov2 || patch sqlite/src/shell.c <<'EOD'
--- sqlite.orig/src/shell.c 2005-04-24 00:43:22.000000000 +0200
+++ sqlite/src/shell.c 2006-05-23 08:22:01.000000000 +0200
@@ -1180,6 +1180,7 @@
" -separator 'x' set output field separator (|)\n"
" -nullvalue 'text' set text string for NULL values\n"
" -version show SQLite version\n"
+ " -encoding show SQLite encoding\n"
" -help show this text, also show dot-commands\n"
;
static void usage(int showDetail){
@@ -1297,7 +1298,10 @@
}else if( strcmp(z,"-echo")==0 ){
data.echoOn = 1;
}else if( strcmp(z,"-version")==0 ){
- printf("%s\n", sqlite_version);
+ printf("%s\n", sqlite_libversion());
+ return 1;
+ }else if( strcmp(z,"-encoding")==0 ){
+ printf("%s\n", sqlite_libencoding());
return 1;
}else if( strcmp(z,"-help")==0 ){
usage(1);
@@ -1330,9 +1334,9 @@
char *zHome;
char *zHistory = 0;
printf(
- "SQLite version %s\n"
+ "SQLite version %s encoding %s\n"
"Enter \".help\" for instructions\n",
- sqlite_version
+ sqlite_libversion(), sqlite_libencoding()
);
zHome = find_home_dir();
if( zHome && (zHistory = malloc(strlen(zHome)+20))!=0 ){
EOD
# use open file dialog when no database name given
# need to link with -lcomdlg32 when enabled
true || patch sqlite/src/shell.c <<'EOD'
--- sqlite.orig/src/shell.c 2006-07-23 11:18:13.000000000 +0200
+++ sqlite/src/shell.c 2006-07-23 11:30:26.000000000 +0200
@@ -20,6 +20,10 @@
#include "sqlite.h"
#include <ctype.h>
+#if defined(_WIN32) && defined(DRIVER_VER_INFO)
+# include <windows.h>
+#endif
+
#if !defined(_WIN32) && !defined(WIN32) && !defined(__MACOS__)
# include <signal.h>
# include <pwd.h>
@@ -1246,6 +1250,17 @@
if( i<argc ){
data.zDbFilename = argv[i++];
}else{
+#if defined(_WIN32) && defined(DRIVER_VER_INFO)
+ static OPENFILENAME ofn;
+ static char zDbFn[1024];
+ ofn.lStructSize = sizeof(ofn);
+ ofn.lpstrFile = (LPTSTR) zDbFn;
+ ofn.nMaxFile = sizeof(zDbFn);
+ ofn.Flags = OFN_PATHMUSTEXIST | OFN_EXPLORER | OFN_NOCHANGEDIR;
+ if( GetOpenFileName(&ofn) ){
+ data.zDbFilename = zDbFn;
+ } else
+#endif
data.zDbFilename = ":memory:";
}
if( i<argc ){
EOD
# same but new module libshell.c
$nov2 || patch sqlite/main.mk <<'EOD'
--- sqlite.orig/main.mk 2007-01-10 19:30:52.000000000 +0100
+++ sqlite/main.mk 2007-01-10 19:33:39.000000000 +0100
@@ -54,7 +54,7 @@
# Object files for the SQLite library.
#
-LIBOBJ = attach.o auth.o btree.o btree_rb.o build.o copy.o date.o delete.o \
+LIBOBJ += attach.o auth.o btree.o btree_rb.o build.o copy.o date.o delete.o \
expr.o func.o hash.o insert.o encode.o \
main.o opcodes.o os.o pager.o parse.o pragma.o printf.o random.o \
select.o table.o tokenize.o trigger.o update.o util.o \
EOD
$nov2 || cp -p sqlite/src/shell.c sqlite/src/libshell.c
$nov2 || patch sqlite/src/libshell.c <<'EOD'
--- sqlite.orig/src/libshell.c 2007-01-10 19:13:01.000000000 +0100
+++ sqlite/src/libshell.c 2007-01-10 19:25:56.000000000 +0100
@@ -20,6 +20,10 @@
#include "sqlite.h"
#include <ctype.h>
+#ifdef _WIN32
+# include <windows.h>
+#endif
+
#if !defined(_WIN32) && !defined(WIN32) && !defined(__MACOS__)
# include <signal.h>
# include <pwd.h>
@@ -1205,7 +1209,7 @@
strcpy(continuePrompt," ...> ");
}
-int main(int argc, char **argv){
+int sqlite_main(int argc, char **argv){
char *zErrMsg = 0;
struct callback_data data;
const char *zInitFile = 0;
@@ -1246,6 +1250,17 @@
if( i<argc ){
data.zDbFilename = argv[i++];
}else{
+#if defined(_WIN32) && !defined(__TINYC__)
+ static OPENFILENAME ofn;
+ static char zDbFn[1024];
+ ofn.lStructSize = sizeof(ofn);
+ ofn.lpstrFile = (LPTSTR) zDbFn;
+ ofn.nMaxFile = sizeof(zDbFn);
+ ofn.Flags = OFN_PATHMUSTEXIST | OFN_EXPLORER | OFN_NOCHANGEDIR;
+ if( GetOpenFileName(&ofn) ){
+ data.zDbFilename = zDbFn;
+ } else
+#endif
data.zDbFilename = ":memory:";
}
if( i<argc ){
EOD
$nov2 || rm -f sqlite/src/minshell.c
$nov2 || touch sqlite/src/minshell.c
$nov2 || patch sqlite/src/minshell.c <<'EOD'
--- sqlite.orig/src/minshell.c 2007-01-10 18:46:47.000000000 +0100
+++ sqlite/src/minshell.c 2007-01-10 18:46:47.000000000 +0100
@@ -0,0 +1,20 @@
+/*
+** 2001 September 15
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+** This file contains code to implement the "sqlite" command line
+** utility for accessing SQLite databases.
+*/
+
+int sqlite_main(int argc, char **argv);
+
+int main(int argc, char **argv){
+ return sqlite_main(argc, argv);
+}
EOD
echo "====================="
echo "Preparing sqlite3 ..."
echo "====================="
test -r sqlite-src-${VER3X}.zip || \
wget -c http://www.sqlite.org/2023/sqlite-src-${VER3X}.zip \
--no-check-certificate
test -r sqlite-src-${VER3X}.zip || exit 1
test -r extension-functions.c ||
wget -O extension-functions.c -c \
'http://www.sqlite.org/contrib/download/extension-functions.c?get=25' \
--no-check-certificate
if test -r extension-functions.c ; then
cp extension-functions.c extfunc.c
patch < extfunc.patch
fi
test -r extfunc.c || exit 1
rm -f sqlite3
rm -rf sqlite-src-${VER3X}
unzip sqlite-src-${VER3X}.zip
ln -sf sqlite-src-${VER3X} sqlite3
test "$VER3" = "3.22.0" \
&& patch sqlite3/tool/mkshellc.tcl <<'EOD'
--- sqlite3.orig/tool/mkshellc.tcl 2018-01-22 19:57:25.000000000 +0100
+++ sqlite3/tool/mkshellc.tcl 2018-02-21 19:25:44.000000000 +0100
@@ -29,7 +29,7 @@
** edit the src/shell.c.in" and/or some of the other files that are included
** by "src/shell.c.in", then rerun the tool/mkshellc.tcl script.
*/}
-set in [open $topdir/src/shell.c.in rb]
+set in [open $topdir/src/shell.c.in r]
proc omit_redundant_typedefs {line} {
global typedef_seen
if {[regexp {^typedef .*;} $line]} {
@@ -46,7 +46,7 @@
if {[regexp {^INCLUDE } $lx]} {
set cfile [lindex $lx 1]
puts $out "/************************* Begin $cfile ******************/"
- set in2 [open $topdir/src/$cfile rb]
+ set in2 [open $topdir/src/$cfile r]
while {![eof $in2]} {
set lx [omit_redundant_typedefs [gets $in2]]
if {[regexp {^#include "sqlite} $lx]} continue
EOD
test -r sqlite3/tool/mkshellc.tcl && \
sed -i -e 's/ rb/ r/g' sqlite3/tool/mkshellc.tcl
# appendText name clash in sqlite3 shell
test "$VER3" = "3.32.2" -o "$VER3" = "3.32.3" -o "$VER3" = "3.42.0" \
-o "$VER3" = "3.43.0" -o "$VER3" = "3.43.2" \
&& perl -pi -e 's/appendText/shAppendText/g' sqlite3/src/shell.c.in
test -r sqlite3/src/shell.c.in &&
( cd sqlite3/src ; tclsh ../tool/mkshellc.tcl > shell.c )
patch sqlite3/main.mk <<'EOD'
--- sqlite3.orig/main.mk 2007-03-31 14:32:21.000000000 +0200
+++ sqlite3/main.mk 2007-04-02 11:04:50.000000000 +0200
@@ -67,7 +67,7 @@
# All of the source code files.
#
-SRC = \
+SRC += \
$(TOP)/src/alter.c \
$(TOP)/src/analyze.c \
$(TOP)/src/attach.c \
EOD
# use open file dialog when no database name given
# need to link with -lcomdlg32 when enabled
true || patch sqlite3/src/shell.c <<'EOD'
--- sqlite3.orig/src/shell.c 2006-06-06 14:32:21.000000000 +0200
+++ sqlite3/src/shell.c 2006-07-23 11:04:50.000000000 +0200
@@ -21,6 +21,10 @@
#include <ctype.h>
#include <stdarg.h>
+#if defined(_WIN32) && defined(DRIVER_VER_INFO)
+# include <windows.h>
+#endif
+
#if !defined(_WIN32) && !defined(WIN32) && !defined(__OS2__)
# include <signal.h>
# include <pwd.h>
@@ -1676,6 +1676,17 @@
if( i<argc ){
data.zDbFilename = argv[i++];
}else{
+#if defined(_WIN32) && defined(DRIVER_VER_INFO)
+ static OPENFILENAME ofn;
+ static char zDbFn[1024];
+ ofn.lStructSize = sizeof(ofn);
+ ofn.lpstrFile = (LPTSTR) zDbFn;
+ ofn.nMaxFile = sizeof(zDbFn);
+ ofn.Flags = OFN_PATHMUSTEXIST | OFN_EXPLORER | OFN_NOCHANGEDIR;
+ if( GetOpenFileName(&ofn) ){
+ data.zDbFilename = zDbFn;
+ } else
+#endif
#ifndef SQLITE_OMIT_MEMORYDB
data.zDbFilename = ":memory:";
#else
EOD
# SQLite 3.5.1 Win32 mutex fix
test "$VER3" != "3.5.1" || patch sqlite3/src/mutex_w32.c <<'EOD'
--- sqlite3.orig/src/mutex_w32.c 2007-08-30 14:10:30
+++ sqlite3/src/mutex_w32.c 2007-09-04 22:31:3
@@ -141,6 +141,12 @@
p->nRef++;
}
int sqlite3_mutex_try(sqlite3_mutex *p){
+ /* The TryEnterCriticalSection() interface is not available on all
+ ** windows systems. Since sqlite3_mutex_try() is only used as an
+ ** optimization, we can skip it on windows. */
+ return SQLITE_BUSY;
+
+#if 0 /* Not Available */
int rc;
assert( p );
assert( p->id==SQLITE_MUTEX_RECURSIVE || sqlite3_mutex_notheld(p) );
@@ -152,6 +158,7 @@
rc = SQLITE_BUSY;
}
return rc;
+#endif
}
/*
EOD
# same but new module libshell.c
cp -p sqlite3/src/shell.c sqlite3/src/libshell.c
test "$VER3" != "3.7.14" -a "$VER3" != "3.7.14.1" -a "$VER3" != "3.7.15" \
-a "$VER3" != "3.7.15.1" -a "$VER3" != "3.7.15.2" -a "$VER3" != "3.7.16" \
-a "$VER3" != "3.7.16.1" -a "$VER3" != "3.7.16.2" -a "$VER3" != "3.7.17" \
-a "$VER3" != "3.8.0" -a "$VER3" != "3.8.1" -a "$VER3" != "3.8.2" \
-a "$VER3" != "3.8.3" -a "$VER3" != "3.8.4" -a "$VER3" != "3.8.4.1" \
-a "$VER3" != "3.8.4.2" -a "$VER3" != "3.8.5" -a "$VER3" != "3.8.6" \
-a "$VER3" != "3.8.7" -a "$VER3" != "3.8.8" -a "$VER3" != "3.8.9" \
-a "$VER3" != "3.8.10" -a "$VER3" != "3.8.11" -a "$VER3" != "3.9.0" \
-a "$VER3" != "3.9.1" -a "$VER3" != "3.9.2" -a "$VER3" != "3.10.0" \
-a "$VER3" != "3.10.2" -a "$VER3" != "3.12.2" -a "$VER3" != "3.13.0" \
-a "$VER3" != "3.14.0" -a "$VER3" != "3.14.1" -a "$VER3" != "3.15.0" \
-a "$VER3" != "3.15.1" -a "$VER3" != "3.15.2" -a "$VER3" != "3.19.3" \
-a "$VER3" != "3.22.0" -a "$VER3" != "3.32.2" -a "$VER3" != "3.32.3" \
-a "$VER3" != "3.42.0" -a "$VER3" != "3.43.0" -a "$VER3" != "3.43.2" \
&& patch sqlite3/src/libshell.c <<'EOD'
--- sqlite3.orig/src/libshell.c 2007-01-08 23:40:05.000000000 +0100
+++ sqlite3/src/libshell.c 2007-01-10 18:35:43.000000000 +0100
@@ -21,6 +21,10 @@
#include <ctype.h>
#include <stdarg.h>
+#ifdef _WIN32
+# include <windows.h>
+#endif
+
#if !defined(_WIN32) && !defined(WIN32) && !defined(__OS2__)
# include <signal.h>
# include <pwd.h>
@@ -1774,7 +1778,7 @@
strcpy(continuePrompt," ...> ");
}
-int main(int argc, char **argv){
+int sqlite3_main(int argc, char **argv){
char *zErrMsg = 0;
struct callback_data data;
const char *zInitFile = 0;
@@ -1816,6 +1820,17 @@
if( i<argc ){
data.zDbFilename = argv[i++];
}else{
+#if defined(_WIN32) && !defined(__TINYC__)
+ static OPENFILENAME ofn;
+ static char zDbFn[1024];
+ ofn.lStructSize = sizeof(ofn);
+ ofn.lpstrFile = (LPTSTR) zDbFn;
+ ofn.nMaxFile = sizeof(zDbFn);
+ ofn.Flags = OFN_PATHMUSTEXIST | OFN_EXPLORER | OFN_NOCHANGEDIR;
+ if( GetOpenFileName(&ofn) ){
+ data.zDbFilename = zDbFn;
+ } else
+#endif
#ifndef SQLITE_OMIT_MEMORYDB
data.zDbFilename = ":memory:";
#else
EOD
test "$VER3" = "3.7.14" -o "$VER3" = "3.7.14.1" \
&& patch sqlite3/src/libshell.c <<'EOD'
--- sqlite3.orig/src/libshell.c 2007-01-08 23:40:05.000000000 +0100
+++ sqlite3/src/libshell.c 2007-01-10 18:35:43.000000000 +0100
@@ -21,6 +21,10 @@
#include <ctype.h>
#include <stdarg.h>
+#ifdef _WIN32
+# include <windows.h>
+#endif
+
#if !defined(_WIN32) && !defined(WIN32)
# include <signal.h>
# include <pwd.h>
@@ -1774,7 +1778,7 @@
strcpy(continuePrompt," ...> ");
}
-int main(int argc, char **argv){
+int sqlite3_main(int argc, char **argv){
char *zErrMsg = 0;
struct callback_data data;
const char *zInitFile = 0;
@@ -1816,6 +1820,17 @@
if( i<argc ){
data.zDbFilename = argv[i++];
}else{
+#if defined(_WIN32) && !defined(__TINYC__)
+ static OPENFILENAME ofn;
+ static char zDbFn[1024];
+ ofn.lStructSize = sizeof(ofn);
+ ofn.lpstrFile = (LPTSTR) zDbFn;
+ ofn.nMaxFile = sizeof(zDbFn);
+ ofn.Flags = OFN_PATHMUSTEXIST | OFN_EXPLORER | OFN_NOCHANGEDIR;
+ if( GetOpenFileName(&ofn) ){
+ data.zDbFilename = zDbFn;
+ } else
+#endif
#ifndef SQLITE_OMIT_MEMORYDB
data.zDbFilename = ":memory:";
#else
EOD
test "$VER3" = "3.7.15" -o "$VER3" = "3.7.15.1" -o "$VER3" = "3.7.15.2" \
-o "$VER3" = "3.7.16" -o "$VER3" = "3.7.16.1" -o "$VER3" = "3.7.16.2" \
-o "$VER3" = "3.7.17" -o "$VER3" = "3.8.0" -o "$VER3" = "3.8.1" \
-o "$VER3" = "3.8.2" -o "$VER3" = "3.8.3" -o "$VER3" = "3.8.4" \
-o "$VER3" = "3.8.4.1" -o "$VER3" = "3.8.4.2" -o "$VER3" = "3.8.5" \
-o "$VER3" = "3.8.6" -o "$VER3" = "3.8.7" -o "$VER3" = "3.8.8" \
&& patch sqlite3/src/libshell.c <<'EOD'
--- sqlite3.orig/src/libshell.c 2012-12-12 14:42:10.000000000 +0100
+++ sqlite3/src/libshell.c 2012-12-13 12:14:57.000000000 +0100
@@ -36,6 +36,10 @@
#include <ctype.h>
#include <stdarg.h>
+#ifdef _WIN32
+#include <windows.h>
+#endif
+
#if !defined(_WIN32) && !defined(WIN32)
# include <signal.h>
# if !defined(__RTP__) && !defined(_WRS_KERNEL)
@@ -2894,7 +2898,7 @@
return argv[i];
}
-int main(int argc, char **argv){
+int sqlite3_main(int argc, char **argv){
char *zErrMsg = 0;
struct callback_data data;
const char *zInitFile = 0;
@@ -2996,6 +3000,17 @@
}
}
if( data.zDbFilename==0 ){
+#if defined(_WIN32) && !defined(__TINYC__)
+ static OPENFILENAME ofn;
+ static char zDbFn[1024];
+ ofn.lStructSize = sizeof(ofn);
+ ofn.lpstrFile = (LPTSTR) zDbFn;
+ ofn.nMaxFile = sizeof(zDbFn);
+ ofn.Flags = OFN_PATHMUSTEXIST | OFN_EXPLORER | OFN_NOCHANGEDIR;
+ if( GetOpenFileName(&ofn) ){
+ data.zDbFilename = zDbFn;
+ } else
+#endif
#ifndef SQLITE_OMIT_MEMORYDB
data.zDbFilename = ":memory:";
#else
EOD
test "$VER3" = "3.8.9" -o "$VER3" = "3.8.10" -o "$VER3" = "3.8.11" \
-o "$VER3" = "3.9.0" -o "$VER3" = "3.9.1" -o "$VER3" = "3.9.2" \
-o "$VER3" = "3.10.0" -o "$VER3" = "3.10.2" -o "$VER3" = "3.12.2" \
&& patch sqlite3/src/libshell.c <<'EOD'
--- sqlite3.orig/src/libshell.c 2012-12-12 14:42:10.000000000 +0100
+++ sqlite3/src/libshell.c 2012-12-13 12:14:57.000000000 +0100
@@ -36,6 +36,10 @@
#include <ctype.h>
#include <stdarg.h>
+#ifdef _WIN32
+#include <windows.h>
+#endif
+
#if !defined(_WIN32) && !defined(WIN32)
# include <signal.h>
# if !defined(__RTP__) && !defined(_WRS_KERNEL)
@@ -2894,7 +2898,7 @@
return argv[i];
}
-int SQLITE_CDECL main(int argc, char **argv){
+int sqlite3_main(int argc, char **argv){
char *zErrMsg = 0;
struct callback_data data;
const char *zInitFile = 0;
@@ -2996,6 +3000,17 @@
}
}
if( data.zDbFilename==0 ){
+#if defined(_WIN32) && !defined(__TINYC__)
+ static OPENFILENAME ofn;
+ static char zDbFn[1024];
+ ofn.lStructSize = sizeof(ofn);
+ ofn.lpstrFile = (LPTSTR) zDbFn;
+ ofn.nMaxFile = sizeof(zDbFn);
+ ofn.Flags = OFN_PATHMUSTEXIST | OFN_EXPLORER | OFN_NOCHANGEDIR;
+ if( GetOpenFileName(&ofn) ){
+ data.zDbFilename = zDbFn;
+ } else
+#endif
#ifndef SQLITE_OMIT_MEMORYDB
data.zDbFilename = ":memory:";
#else
EOD
test "$VER3" = "3.22.0" -o "$VER3" = "3.32.2" -o "$VER3" = "3.32.3" \
-o "$VER3" = "3.42.0" -o "$VER3" = "3.43.0" -o "$VER3" = "3.43.2" \
&& patch sqlite3/src/os_win.h <<'EOD'
--- sqlite3.orig/src/os_win.h 2018-01-22 19:57:25.000000000 +0100
+++ sqlite3/src/os_win.h 2018-02-21 21:13:46.000000000 +0100
@@ -22,8 +22,9 @@
#ifdef __CYGWIN__
# include <sys/cygwin.h>
-# include <errno.h> /* amalgamator: dontcache */
#endif
+#include <sys/stat.h> /* amalgamator: dontcache */
+#include <errno.h> /* amalgamator: dontcache */
/*
** Determine if we are dealing with Windows NT.
EOD
test "$VER3" = "3.13.0" -o "$VER3" = "3.14.0" -o "$VER3" = "3.14.1" \
-o "$VER3" = "3.15.0" -o "$VER3" = "3.15.1" -o "$VER3" = "3.15.2" \
-o "$VER3" = "3.19.3" -o "$VER3" = "3.22.0" -o "$VER3" = "3.32.2" \
-o "$VER3" = "3.32.3" \
&& patch sqlite3/src/libshell.c <<'EOD'
--- sqlite3.orig/src/libshell.c.orig 2016-05-18 13:06:59.000000000 +0200
+++ sqlite3/src/libshell.c 2016-06-04 17:02:05.000000000 +0200
@@ -53,6 +53,10 @@
#include <ctype.h>
#include <stdarg.h>
+#ifdef _WIN32
+#include <windows.h>
+#endif
+
#if !defined(_WIN32) && !defined(WIN32)
# include <signal.h>
# if !defined(__RTP__) && !defined(_WRS_KERNEL)
@@ -5195,20 +5199,9 @@
return argv[i];
}
-#ifndef SQLITE_SHELL_IS_UTF8
-# if (defined(_WIN32) || defined(WIN32)) && defined(_MSC_VER)
-# define SQLITE_SHELL_IS_UTF8 (0)
-# else
-# define SQLITE_SHELL_IS_UTF8 (1)
-# endif
-#endif
+#define SQLITE_SHELL_IS_UTF8 (1)
-#if SQLITE_SHELL_IS_UTF8
-int SQLITE_CDECL main(int argc, char **argv){
-#else
-int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
- char **argv;
-#endif
+int sqlite3_main(int argc, char **argv){
char *zErrMsg = 0;
ShellState data;
const char *zInitFile = 0;
@@ -5375,6 +5368,19 @@
}
}
if( data.zDbFilename==0 ){
+#if defined(_WIN32) && !defined(__TINYC__)
+ static OPENFILENAME ofn;
+ static char zDbFn[1024];
+ ofn.lStructSize = sizeof(ofn);
+ ofn.lpstrFile = (LPTSTR) zDbFn;
+ ofn.nMaxFile = sizeof(zDbFn);
+ ofn.Flags = OFN_PATHMUSTEXIST | OFN_EXPLORER | OFN_NOCHANGEDIR;
+ if ( GetOpenFileName(&ofn) ){
+ data.zDbFilename = zDbFn;
+ }
+ }
+ if( data.zDbFilename==0 ){
+#endif
#ifndef SQLITE_OMIT_MEMORYDB
data.zDbFilename = ":memory:";
warnInmemoryDb = argc==1;
EOD
test "$VER3" = "3.42.0" -o "$VER3" = "3.43.0" -o "$VER3" = "3.43.2" \
&& rm -f sqlite3/src/libshell.c && patch sqlite3/src/libshell.c <<'EOD'
--- /dev/null 2023-08-23 14:06:59.000000000 +0200
+++ sqlite3/src/libshell.c 2023-08-23 14:06:59.00000000 +0200
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+int sqlite3_main(int argc, char **argv)
+{
+ fprintf(stderr, "not supported anymore\n");
+ return 1;
+}
EOD
rm -f sqlite3/src/minshell.c
touch sqlite3/src/minshell.c
test "$VER3" != "3.42.0" -a "$VER3" != "3.43.0" -a "$VER3" != "3.43.2" \
&& patch sqlite3/src/minshell.c <<'EOD'
--- sqlite3.orig/src/minshell.c 2007-01-10 18:46:47.000000000 +0100
+++ sqlite3/src/minshell.c 2007-01-10 18:46:47.000000000 +0100
@@ -0,0 +1,20 @@
+/*
+** 2001 September 15
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+** This file contains code to implement the "sqlite" command line
+** utility for accessing SQLite databases.
+*/
+
+int sqlite3_main(int argc, char **argv);
+
+int main(int argc, char **argv){
+ return sqlite3_main(argc, argv);
+}
EOD
test "$VER3" = "3.42.0" -o "$VER3" = "3.43.0" -o "$VER3" = "3.43.2" \
&& cp -p sqlite3/src/shell.c sqlite3/src/minshell.c \
&& patch -d sqlite3 -p1 <<'EOD'
--- sqlite3.orig/src/minshell.c 2023-08-24 21:58:36.000000000 +0200
+++ sqlite3/src/minshell.c 2023-08-25 16:11:55.290287100 +0200
@@ -128,6 +129,10 @@
#include <ctype.h>
#include <stdarg.h>
+#ifdef _WIN32
+#include <windows.h>
+#endif
+
#if !defined(_WIN32) && !defined(WIN32)
# include <signal.h>
# if !defined(__RTP__) && !defined(_WRS_KERNEL) && !defined(SQLITE_WASI)
@@ -28154,6 +28158,23 @@
}
}
+#if defined(_WIN32) && !defined(__TINYC__)
+ if( data.pAuxDb->zDbFilename==0 ){
+ static OPENFILENAMEW ofn;
+ static WCHAR wDbFn[1024];
+ static char zDbFn[4096];
+ ofn.lStructSize = sizeof(ofn);
+ ofn.lpstrFile = (LPTSTR) wDbFn;
+ ofn.nMaxFile = sizeof(wDbFn);
+ ofn.Flags = OFN_PATHMUSTEXIST | OFN_EXPLORER | OFN_NOCHANGEDIR;
+ if( GetOpenFileNameW(&ofn) ){
+ WideCharToMultiByte(CP_UTF8, 0, wDbFn, -1, zDbFn, sizeof(zDbFn),
+ NULL, NULL);
+ data.pAuxDb->zDbFilename = zDbFn;
+ }
+ }
+#endif
+
if( data.pAuxDb->zDbFilename==0 ){
#ifndef SQLITE_OMIT_MEMORYDB
data.pAuxDb->zDbFilename = ":memory:";
EOD
# amalgamation: add libshell.c
test "$VER3" != "3.5.6" && test -r sqlite3/tool/mksqlite3c.tcl && \
patch -d sqlite3 -p1 <<'EOD'
--- sqlite3.orig/tool/mksqlite3c.tcl 2007-04-02 14:20:10.000000000 +0200
+++ sqlite3/tool/mksqlite3c.tcl 2007-04-03 09:42:03.000000000 +0200
@@ -194,6 +194,7 @@
where.c
parse.c
+ libshell.c
tokenize.c
complete.c
EOD
test "$VER3" = "3.5.6" && test -r sqlite3/tool/mksqlite3c.tcl && \
patch -d sqlite3 -p1 <<'EOD'
--- sqlite3.orig/tool/mksqlite3c.tcl 2007-04-02 14:20:10.000000000 +0200
+++ sqlite3/tool/mksqlite3c.tcl 2007-04-03 09:42:03.000000000 +0200
@@ -200,6 +200,7 @@
main.c
+ libshell.c
fts3.c
fts3_hash.c
fts3_porter.c
EOD
# patch: parse foreign key constraints on virtual tables
test "$VER3" != "3.6.15" -a "$VER3" != "3.6.16" -a "$VER3" != "3.6.17" \
-a "$VER3" != "3.6.18" -a "$VER3" != "3.6.19" -a "$VER3" != "3.6.20" \
-a "$VER3" != "3.6.21" -a "$VER3" != "3.6.22" -a "$VER3" != "3.6.23" \
-a "$VER3" != "3.6.23.1" -a "$VER3" != "3.7.0" -a "$VER3" != "3.7.0.1" \
-a "$VER3" != "3.7.1" -a "$VER3" != "3.7.2" -a "$VER3" != "3.7.3" \
-a "$VER3" != "3.7.4" -a "$VER3" != "3.7.5" -a "$VER3" != "3.7.6" \
-a "$VER3" != "3.7.6.1" -a "$VER3" != "3.7.6.2" -a "$VER3" != "3.7.6.3" \
-a "$VER3" != "3.7.7" -a "$VER3" != "3.7.7.1" -a "$VER3" != "3.7.8" \
-a "$VER3" != "3.7.9" -a "$VER3" != "3.7.10" -a "$VER3" != "3.7.11" \
-a "$VER3" != "3.7.12" -a "$VER3" != "3.7.12.1" -a "$VER3" != "3.7.13" \
-a "$VER3" != "3.7.14" -a "$VER3" != "3.7.14.1" -a "$VER3" != "3.7.15" \
-a "$VER3" != "3.7.15.1" -a "$VER3" != "3.7.15.2" -a "$VER3" != "3.7.16" \
-a "$VER3" != "3.7.16.1" -a "$VER3" != "3.7.16.2" -a "$VER3" != "3.7.17" \
-a "$VER3" != "3.8.0" -a "$VER3" != "3.8.1" -a "$VER3" != "3.8.2" \
-a "$VER3" != "3.8.3" -a "$VER3" != "3.8.4" -a "$VER3" != "3.8.4.1" \
-a "$VER3" != "3.8.4.2" -a "$VER3" != "3.8.5" -a "$VER3" != "3.8.6" \
-a "$VER3" != "3.8.7" -a "$VER3" != "3.8.8" -a "$VER3" != "3.8.9" \
-a "$VER3" != "3.8.10" -a "$VER3" != "3.8.11" -a "$VER3" != "3.9.0" \
-a "$VER3" != "3.9.1" -a "$VER3" != "3.9.2" -a "$VER3" != "3.10.0" \
-a "$VER3" != "3.10.2" -a "$VER3" != "3.12.2" -a "$VER3" != "3.13.0" \
-a "$VER3" != "3.14.0" -a "$VER3" != "3.14.1" -a "$VER3" != "3.15.0" \
-a "$VER3" != "3.15.1" -a "$VER3" != "3.15.2" -a "$VER3" != "3.19.3" \
-a "$VER3" != "3.22.0" -a "$VER3" != "3.32.2" -a "$VER3" != "3.32.3" \
-a "$VER3" != "3.42.0" -a "$VER3" != "3.43.0" -a "$VER3" != "3.43.2" \
&& patch -d sqlite3 -p1 <<'EOD'
diff -u sqlite3.orig/src/build.c sqlite3/src/build.c
--- sqlite3.orig/src/build.c 2007-01-09 14:53:04.000000000 +0100
+++ sqlite3/src/build.c 2007-01-30 08:14:41.000000000 +0100
@@ -2063,7 +2063,7 @@
char *z;
assert( pTo!=0 );
- if( p==0 || pParse->nErr || IN_DECLARE_VTAB ) goto fk_end;
+ if( p==0 || pParse->nErr ) goto fk_end;
if( pFromCol==0 ){
int iCol = p->nCol-1;
if( iCol<0 ) goto fk_end;
diff -u sqlite3.orig/src/pragma.c sqlite3/src/pragma.c
--- sqlite3.orig/src/pragma.c 2007-01-27 03:24:56.000000000 +0100
+++ sqlite3/src/pragma.c 2007-01-30 09:19:30.000000000 +0100
@@ -589,6 +589,9 @@
pTab = sqlite3FindTable(db, zRight, zDb);
if( pTab ){
v = sqlite3GetVdbe(pParse);
+#ifndef SQLITE_OMIT_VIRTUAL_TABLE
+ if( pTab->pVtab ) sqlite3ViewGetColumnNames(pParse, pTab);
+#endif
pFK = pTab->pFKey;
if( pFK ){
int i = 0;
diff -u sqlite3.orig/src/vtab.c sqlite3/src/vtab.c
--- sqlite3.orig/src/vtab.c 2007-01-09 15:01:14.000000000 +0100
+++ sqlite3/src/vtab.c 2007-01-30 08:23:22.000000000 +0100
@@ -540,6 +540,9 @@
int rc = SQLITE_OK;
Table *pTab = db->pVTab;
char *zErr = 0;
+#ifndef SQLITE_OMIT_FOREIGN_KEYS
+ FKey *pFKey;
+#endif
sqlite3_mutex_enter(db->mutex);
pTab = db->pVTab;
@@ -568,6 +571,15 @@
}
sParse.declareVtab = 0;
+#ifndef SQLITE_OMIT_FOREIGN_KEYS
+ assert( pTab->pFKey==0 );
+ pTab->pFKey = sParse.pNewTable->pFKey;
+ sParse.pNewTable->pFKey = 0;
+ for(pFKey=pTab->pFKey; pFKey; pFKey=pFKey->pNextFrom){
+ pFKey->pFrom=pTab;
+ }
+#endif
+
if( sParse.pVdbe ){
sqlite3VdbeFinalize(sParse.pVdbe);
}
EOD
# patch: re-enable NO_TCL in tclsqlite.c (3.3.15)
test "$VER3" != "3.8.8" -a "$VER3" != "3.8.9" -a "$VER3" != "3.8.10" \
-a "$VER3" != "3.8.11" -a "$VER3" != "3.9.0" -a "$VER3" != "3.9.1" \
-a "$VER3" != "3.9.2" -a "$VER3" != "3.10.0" -a "$VER3" != "3.10.2" \
-a "$VER3" != "3.12.2" -a "$VER3" != "3.13.0" -a "$VER3" != "3.14.0" \
-a "$VER3" != "3.14.1" -a "$VER3" != "3.15.0" -a "$VER3" != "3.15.1" \
-a "$VER3" != "3.15.2" -a "$VER3" != "3.19.3" -a "$VER3" != "3.22.0" \
-a "$VER3" != "3.32.2" -a "$VER3" != "3.32.3" -a "$VER3" != "3.42.0" \
-a "$VER3" != "3.43.0" -a "$VER3" != "3.43.2" \
&& patch -d sqlite3 -p1 <<'EOD'
diff -u sqlite3.orig/src/tclsqlite.c sqlite3/src/tclsqlite.c
--- sqlite3.orig/src/tclsqlite.c 2007-04-06 17:02:14.000000000 +0200
+++ sqlite3/src/tclsqlite.c 2007-04-10 07:47:49.000000000 +0200
@@ -14,6 +14,7 @@
**
** $Id: mingw-cross-build.sh,v 1.113 2023/10/23 13:31:50 chw Exp chw $
*/
+#ifndef NO_TCL /* Omit this whole file if TCL is unavailable */
#include "tcl.h"
/*
@@ -2264,3 +2265,5 @@
return 0;
}
#endif /* TCLSH */
+
+#endif /* !defined(NO_TCL) */
EOD
test "$VER3" = "3.8.8" -o "$VER3" = "3.8.9" -o "$VER3" = "3.8.10" \
-o "$VER3" = "3.8.11" -o "$VER3" = "3.9.0" -o "$VER3" = "3.9.1" \
-o "$VER3" = "3.9.2" -o "$VER3" = "3.10.0" -o "$VER3" = "3.10.2" \
-o "$VER3" = "3.12.2" -o "$VER3" = "3.13.0" -o "$VER3" = "3.14.0" \
-o "$VER3" = "3.14.1" -o "$VER3" = "3.15.0" -o "$VER3" = "3.15.1" \
-o "$VER3" = "3.15.2" -o "$VER3" = "3.19.3" -o "$VER3" = "3.22.0" \
-o "$VER3" = "3.32.2" -o "$VER3" = "3.32.3" -o "$VER3" = "3.42.0" \
-o "$VER3" = "3.43.0" -o "$VER3" = "3.43.2" \
&& patch -d sqlite3 -p1 <<'EOD'
--- sqlite3.orig/src/tclsqlite.c 2015-01-16 14:47:26.000000000 +0100
+++ sqlite3/src/tclsqlite.c 2015-01-19 17:56:26.517386413 +0100
@@ -29,6 +29,7 @@
/*
** If requested, include the SQLite compiler options file for MSVC.
*/
+#ifndef NO_TCL /* Omit this whole file if TCL is unavailable */
#if defined(INCLUDE_MSVC_H)
#include "msvc.h"
#endif
@@ -3888,3 +3889,5 @@
return 0;
}
#endif /* TCLSH */
+
+#endif /* !defined(NO_TCL) */
EOD
# patch: Win32 locking and pager unlock, for SQLite3 < 3.4.0
true || patch -d sqlite3 -p1 <<'EOD'
--- sqlite3.orig/src/os_win.c 2007-04-11 19:52:04.000000000 +0200
+++ sqlite3/src/os_win.c 2007-05-08 06:57:06.000000000 +0200
@@ -1237,8 +1237,8 @@
** the PENDING_LOCK byte is temporary.
*/
newLocktype = pFile->locktype;
- if( pFile->locktype==NO_LOCK
- || (locktype==EXCLUSIVE_LOCK && pFile->locktype==RESERVED_LOCK)
+ if( locktype==SHARED_LOCK
+ || (locktype==EXCLUSIVE_LOCK && pFile->locktype<PENDING_LOCK)
){
int cnt = 3;
while( cnt-->0 && (res = LockFile(pFile->h, PENDING_BYTE, 0, 1, 0))==0 ){
@@ -1289,6 +1289,18 @@
newLocktype = EXCLUSIVE_LOCK;
}else{
OSTRACE2("error-code = %d\n", GetLastError());
+ if( !getReadLock(pFile) ){
+ /* This should never happen. We should always be able to
+ ** reacquire the read lock */
+ OSTRACE1("could not re-get a SHARED lock.\n");
+ if( newLocktype==PENDING_LOCK || pFile->locktype==PENDING_LOCK ){
+ UnlockFile(pFile->h, PENDING_BYTE, 0, 1, 0);
+ }
+ if( pFile->locktype==RESERVED_LOCK ){
+ UnlockFile(pFile->h, RESERVED_BYTE, 0, 1, 0);
+ }
+ newLocktype = NO_LOCK;
+ }
}
}
@@ -1362,6 +1374,7 @@
/* This should never happen. We should always be able to
** reacquire the read lock */
rc = SQLITE_IOERR_UNLOCK;
+ locktype = NO_LOCK;
}
}
if( type>=RESERVED_LOCK ){
EOD
# patch: Win32 locking and pager unlock, for SQLite3 >= 3.5.4 && <= 3.6.10
true || patch -d sqlite3 -p1 <<'EOD'
--- sqlite3.orig/src/os_win.c 2007-12-13 22:38:58.000000000 +0100
+++ sqlite3/src/os_win.c 2008-01-18 10:01:48.000000000 +0100
@@ -855,8 +855,8 @@
** the PENDING_LOCK byte is temporary.
*/
newLocktype = pFile->locktype;
- if( pFile->locktype==NO_LOCK
- || (locktype==EXCLUSIVE_LOCK && pFile->locktype==RESERVED_LOCK)
+ if( locktype==SHARED_LOCK
+ || (locktype==EXCLUSIVE_LOCK && pFile->locktype<PENDING_LOCK)
){
int cnt = 3;
while( cnt-->0 && (res = LockFile(pFile->h, PENDING_BYTE, 0, 1, 0))==0 ){
@@ -907,7 +907,18 @@
newLocktype = EXCLUSIVE_LOCK;
}else{
OSTRACE2("error-code = %d\n", GetLastError());
- getReadLock(pFile);
+ if( !getReadLock(pFile) ){
+ /* This should never happen. We should always be able to
+ ** reacquire the read lock */
+ OSTRACE1("could not re-get a SHARED lock.\n");
+ if( newLocktype==PENDING_LOCK || pFile->locktype==PENDING_LOCK ){
+ UnlockFile(pFile->h, PENDING_BYTE, 0, 1, 0);
+ }
+ if( pFile->locktype==RESERVED_LOCK ){
+ UnlockFile(pFile->h, RESERVED_BYTE, 0, 1, 0);
+ }
+ newLocktype = NO_LOCK;
+ }
}
}
@@ -982,6 +993,7 @@
/* This should never happen. We should always be able to
** reacquire the read lock */
rc = SQLITE_IOERR_UNLOCK;
+ locktype = NO_LOCK;
}
}
if( type>=RESERVED_LOCK ){
EOD
# patch: Win32 locking and pager unlock, for SQLite3 >= 3.6.11 && < 3.7.0
true || patch -d sqlite3 -p1 <<'EOD'
--- sqlite3.orig/src/os_win.c 2009-02-15 14:07:09.000000000 +0100
+++ sqlite3/src/os_win.c 2009-02-20 16:39:48.000000000 +0100
@@ -922,7 +922,7 @@
newLocktype = pFile->locktype;
if( (pFile->locktype==NO_LOCK)
|| ( (locktype==EXCLUSIVE_LOCK)
- && (pFile->locktype==RESERVED_LOCK))
+ && (pFile->locktype<RESERVED_LOCK))
){
int cnt = 3;
while( cnt-->0 && (res = LockFile(pFile->h, PENDING_BYTE, 0, 1, 0))==0 ){
@@ -981,7 +981,18 @@
}else{
error = GetLastError();
OSTRACE2("error-code = %d\n", error);
- getReadLock(pFile);
+ if( !getReadLock(pFile) ){
+ /* This should never happen. We should always be able to
+ ** reacquire the read lock */
+ OSTRACE1("could not re-get a SHARED lock.\n");
+ if( newLocktype==PENDING_LOCK || pFile->locktype==PENDING_LOCK ){
+ UnlockFile(pFile->h, PENDING_BYTE, 0, 1, 0);
+ }
+ if( pFile->locktype==RESERVED_LOCK ){
+ UnlockFile(pFile->h, RESERVED_BYTE, 0, 1, 0);
+ }
+ newLocktype = NO_LOCK;
+ }
}
}
@@ -1057,6 +1068,7 @@
/* This should never happen. We should always be able to
** reacquire the read lock */
rc = SQLITE_IOERR_UNLOCK;
+ locktype = NO_LOCK;
}
}
if( type>=RESERVED_LOCK ){
EOD
# patch: compile fix for FTS3 as extension module
test "$VER3" != "3.6.21" -a "$VER3" != "3.6.22" -a "$VER3" != "3.6.23" \
-a "$VER3" != "3.6.23.1" -a "$VER3" != "3.7.0" -a "$VER3" != "3.7.0.1" \
-a "$VER3" != "3.7.1" -a "$VER3" != "3.7.2" -a "$VER3" != "3.7.3" \
-a "$VER3" != "3.7.4" -a "$VER3" != "3.7.5" -a "$VER3" != "3.7.6" \
-a "$VER3" != "3.7.6.1" -a "$VER3" != "3.7.6.2" -a "$VER3" != "3.7.6.3" \
-a "$VER3" != "3.7.7" -a "$VER3" != "3.7.7.1" -a "$VER3" != "3.7.8" \
-a "$VER3" != "3.7.9" -a "$VER3" != "3.7.10" -a "$VER3" != "3.7.11" \
-a "$VER3" != "3.7.12" -a "$VER3" != "3.7.12.1" -a "$VER3" != "3.7.13" \
-a "$VER3" != "3.7.14" -a "$VER3" != "3.7.14.1" -a "$VER3" != "3.7.15" \
-a "$VER3" != "3.7.15.1" -a "$VER3" != "3.7.15.2" -a "$VER3" != "3.7.16" \
-a "$VER3" != "3.7.16.1" -a "$VER3" != "3.7.16.2" -a "$VER3" != "3.7.17" \
-a "$VER3" != "3.8.0" -a "$VER3" != "3.8.1" -a "$VER3" != "3.8.2" \
-a "$VER3" != "3.8.3" -a "$VER3" != "3.8.4" -a "$VER3" != "3.8.4.1" \
-a "$VER3" != "3.8.4.2" -a "$VER3" != "3.8.5" -a "$VER3" != "3.8.6" \
-a "$VER3" != "3.8.7" -a "$VER3" != "3.8.8" -a "$VER3" != "3.8.9" \
-a "$VER3" != "3.8.10" -a "$VER3" != "3.8.11" -a "$VER3" != "3.9.0" \
-a "$VER3" != "3.9.1" -a "$VER3" != "3.9.2" -a "$VER3" != "3.10.0" \
-a "$VER3" != "3.10.2" -a "$VER3" != "3.12.2" -a "$VER3" != "3.13.0" \
-a "$VER3" != "3.14.0" -a "$VER3" != "3.14.1" -a "$VER3" != "3.15.0" \
-a "$VER3" != "3.15.1" -a "$VER3" != "3.15.2" -a "$VER3" != "3.19.3" \
-a "$VER3" != "3.22.0" -a "$VER3" != "3.32.2" -a "$VER3" != "3.32.3" \
-a "$VER3" != "3.42.0" -a "$VER3" != "3.43.0" -a "$VER3" != "3.43.2" \
&& patch -d sqlite3 -p1 <<'EOD'
--- sqlite3.orig/ext/fts3/fts3.c 2008-02-02 17:24:34.000000000 +0100
+++ sqlite3/ext/fts3/fts3.c 2008-03-16 11:29:02.000000000 +0100
@@ -274,10 +274,6 @@
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
-#if defined(SQLITE_ENABLE_FTS3) && !defined(SQLITE_CORE)
-# define SQLITE_CORE 1
-#endif
-
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
@@ -6389,7 +6385,7 @@
return rc;
}
-#if !SQLITE_CORE
+#ifndef SQLITE_CORE
int sqlite3_extension_init(
sqlite3 *db,
char **pzErrMsg,
--- sqlite3.orig/ext/fts3/fts3_porter.c 2008-02-01 16:40:34.000000000 +0100
+++ sqlite3/ext/fts3/fts3_porter.c 2008-03-16 11:34:50.000000000 +0100
@@ -31,6 +31,11 @@
#include <string.h>
#include <ctype.h>
+#include "sqlite3ext.h"
+#ifndef SQLITE_CORE
+extern const sqlite3_api_routines *sqlite3_api;
+#endif
+
#include "fts3_tokenizer.h"
/*
--- sqlite3.orig/ext/fts3/fts3_tokenizer1.c 2007-11-23 18:31:18.000000000 +0100
+++ sqlite3/ext/fts3/fts3_tokenizer1.c 2008-03-16 11:35:37.000000000 +0100
@@ -31,6 +31,11 @@
#include <string.h>
#include <ctype.h>
+#include "sqlite3ext.h"
+#ifndef SQLITE_CORE
+extern const sqlite3_api_routines *sqlite3_api;
+#endif
+
#include "fts3_tokenizer.h"
typedef struct simple_tokenizer {
--- sqlite3.orig/ext/fts3/fts3_hash.c 2007-11-24 01:41:52.000000000 +0100
+++ sqlite3/ext/fts3/fts3_hash.c 2008-03-16 11:39:57.000000000 +0100
@@ -29,6 +29,11 @@
#include <stdlib.h>
#include <string.h>
+#include "sqlite3ext.h"
+#ifndef SQLITE_CORE
+extern const sqlite3_api_routines *sqlite3_api;
+#endif
+
#include "sqlite3.h"
#include "fts3_hash.h"
--- sqlite3.orig/ext/fts3/fts3_tokenizer.c 2008-06-24 03:29:58.000000000 +0200
+++ sqlite3/ext/fts3/fts3_tokenizer.c 2008-07-17 08:38:24.000000000 +0200
@@ -27,7 +27,7 @@
#include "sqlite3ext.h"
#ifndef SQLITE_CORE
- SQLITE_EXTENSION_INIT1
+extern const sqlite3_api_routines *sqlite3_api;
#endif
#include "fts3_hash.h"
EOD
test "$VER3" = "3.6.21" -o "$VER3" = "3.6.22" -o "$VER3" = "3.6.23" \
-o "$VER3" = "3.6.23.1" -o "$VER3" = "3.7.0" -o "$VER3" = "3.7.0.1" \
-o "$VER3" = "3.7.1" -o "$VER3" = "3.7.2" -o "$VER3" = "3.7.3" \
-o "$VER3" = "3.7.4" -o "$VER3" = "3.7.5" -o "$VER3" = "3.7.6" \
-o "$VER3" = "3.7.6.1" -o "$VER3" = "3.7.6.2" -o "$VER3" = "3.7.6.3" \
&& patch -d sqlite3 -p1 <<'EOD'
--- sqlite3.orig/ext/fts3/fts3.c 2008-02-02 17:24:34.000000000 +0100
+++ sqlite3/ext/fts3/fts3.c 2008-03-16 11:29:02.000000000 +0100
@@ -274,10 +274,6 @@
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
-#if defined(SQLITE_ENABLE_FTS3) && !defined(SQLITE_CORE)
-# define SQLITE_CORE 1
-#endif
-
#include "fts3Int.h"
#include <assert.h>
@@ -6389,7 +6385,7 @@
return rc;
}
-#if !SQLITE_CORE
+#ifndef SQLITE_CORE
int sqlite3_extension_init(
sqlite3 *db,
char **pzErrMsg,
EOD
patch -d sqlite3 -p1 <<'EOD'
--- sqlite3.orig/ext/fts3/fts3_porter.c 2008-02-01 16:40:34.000000000 +0100
+++ sqlite3/ext/fts3/fts3_porter.c 2008-03-16 11:34:50.000000000 +0100
@@ -31,6 +31,11 @@
#include <string.h>
#include <ctype.h>
+#include "sqlite3ext.h"
+#ifndef SQLITE_CORE
+extern const sqlite3_api_routines *sqlite3_api;
+#endif
+
#include "fts3_tokenizer.h"
/*
--- sqlite3.orig/ext/fts3/fts3_tokenizer1.c 2007-11-23 18:31:18.000000000 +0100
+++ sqlite3/ext/fts3/fts3_tokenizer1.c 2008-03-16 11:35:37.000000000 +0100
@@ -31,6 +31,11 @@
#include <string.h>
#include <ctype.h>
+#include "sqlite3ext.h"
+#ifndef SQLITE_CORE
+extern const sqlite3_api_routines *sqlite3_api;
+#endif
+
#include "fts3_tokenizer.h"
typedef struct simple_tokenizer {
EOD
test "$VER3" != "3.7.8" -a "$VER3" != "3.7.9" -a "$VER3" != "3.7.10" \
-a "$VER3" != "3.7.11" -a "$VER3" != "3.7.12" -a "$VER3" != "3.7.12.1" \
-a "$VER3" != "3.7.13" -a "$VER3" != "3.7.14" -a "$VER3" != "3.7.14.1" \
-a "$VER3" != "3.7.15" -a "$VER3" != "3.7.15.1" -a "$VER3" != "3.7.15.2" \
-a "$VER3" != "3.7.16" -a "$VER3" != "3.7.16.1" -a "$VER3" != "3.7.16.2" \
-a "$VER3" != "3.7.17" -a "$VER3" != "3.8.0" -a "$VER3" != "3.8.1" \
-a "$VER3" != "3.8.2" -a "$VER3" != "3.8.3" -a "$VER3" != "3.8.4" \
-a "$VER3" != "3.8.4.1" -a "$VER3" != "3.8.4.2" -a "$VER3" != "3.8.5" \
-a "$VER3" != "3.8.6" -a "$VER3" != "3.8.7" -a "$VER3" != "3.8.8" \
-a "$VER3" != "3.8.9" -a "$VER3" != "3.8.10" -a "$VER3" != "3.8.11" \
-a "$VER3" != "3.9.0" -a "$VER3" != "3.9.1" -a "$VER3" != "3.9.2" \
-a "$VER3" != "3.10.0" -a "$VER3" != "3.10.2" -a "$VER3" != "3.12.2" \
-a "$VER3" != "3.13.0" -a "$VER3" != "3.14.0" -a "$VER3" != "3.14.1" \
-a "$VER3" != "3.15.0" -a "$VER3" != "3.15.1" -a "$VER3" != "3.15.2" \
-a "$VER3" != "3.19.3" -a "$VER3" != "3.22.0" -a "$VER3" != "3.32.2" \
-a "$VER3" != "3.32.3" -a "$VER3" != "3.42.0" -a "$VER3" != "3.43.0" \
-a "$VER3" != "3.43.2" \
&& patch -d sqlite3 -p1 <<'EOD'
--- sqlite3.orig/ext/fts3/fts3_hash.c 2007-11-24 01:41:52.000000000 +0100
+++ sqlite3/ext/fts3/fts3_hash.c 2008-03-16 11:39:57.000000000 +0100
@@ -29,6 +29,11 @@
#include <stdlib.h>
#include <string.h>
+#include "sqlite3ext.h"
+#ifndef SQLITE_CORE
+extern const sqlite3_api_routines *sqlite3_api;
+#endif
+
#include "sqlite3.h"
#include "fts3_hash.h"
EOD
test "$VER3" = "3.6.21" && patch -d sqlite3 -p1 <<'EOD'
--- sqlite3.orig/ext/fts3/fts3_write.c 2009-12-03 20:39:06.000000000 +0100
+++ sqlite3/ext/fts3/fts3_write.c 2010-01-05 07:59:27.000000000 +0100
@@ -20,6 +20,10 @@
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
#include "fts3Int.h"
+#include "sqlite3ext.h"
+#ifndef SQLITE_CORE
+extern const sqlite3_api_routines *sqlite3_api;
+#endif
#include <string.h>
#include <assert.h>
#include <stdlib.h>
EOD
test "$VER3" = "3.6.22" -o "$VER3" = "3.6.23" -o "$VER3" = "3.6.23.1" \
-o "$VER3" = "3.7.0" -o "$VER3" = "3.7.0.1" \
-o "$VER3" = "3.7.1" -o "$VER3" = "3.7.2" -o "$VER3" = "3.7.3" \
-o "$VER3" = "3.7.4" -o "$VER3" = "3.7.5" \
&& patch -d sqlite3 -p1 <<'EOD'
--- sqlite3.orig/ext/fts3/fts3_write.c 2010-01-05 09:42:19.000000000 +0100
+++ sqlite3/ext/fts3/fts3_write.c 2010-01-05 09:55:25.000000000 +0100
@@ -20,6 +20,10 @@
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
#include "fts3Int.h"
+#include "sqlite3ext.h"
+#ifndef SQLITE_CORE
+extern const sqlite3_api_routines *sqlite3_api;
+#endif
#include <string.h>
#include <assert.h>
#include <stdlib.h>
@@ -2226,7 +2230,7 @@
if( !zVal ){
return SQLITE_NOMEM;
- }else if( nVal==8 && 0==sqlite3_strnicmp(zVal, "optimize", 8) ){
+ }else if( nVal==8 && 0==strnicmp(zVal, "optimize", 8) ){
rc = fts3SegmentMerge(p, -1);
if( rc==SQLITE_DONE ){
rc = SQLITE_OK;
@@ -2234,10 +2238,10 @@
sqlite3Fts3PendingTermsClear(p);
}
#ifdef SQLITE_TEST
- }else if( nVal>9 && 0==sqlite3_strnicmp(zVal, "nodesize=", 9) ){
+ }else if( nVal>9 && 0==strnicmp(zVal, "nodesize=", 9) ){
p->nNodeSize = atoi(&zVal[9]);
rc = SQLITE_OK;
- }else if( nVal>11 && 0==sqlite3_strnicmp(zVal, "maxpending=", 9) ){
+ }else if( nVal>11 && 0==strnicmp(zVal, "maxpending=", 9) ){
p->nMaxPendingData = atoi(&zVal[11]);
rc = SQLITE_OK;
#endif
EOD
test "$VER3" = "3.7.6" -o "$VER3" = "3.7.6.1" -o "$VER3" = "3.7.6.2" \
-o "$VER3" = "3.7.6.3" \
&& patch -d sqlite3 -p1 <<'EOD'
--- sqlite3.orig/ext/fts3/fts3_write.c 2011-04-12 11:44:56.000000000 +0200
+++ sqlite3/ext/fts3/fts3_write.c 2011-04-13 08:00:51.000000000 +0200
@@ -20,6 +20,10 @@
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
#include "fts3Int.h"
+#include "sqlite3ext.h"
+#ifndef SQLITE_CORE
+extern const sqlite3_api_routines *sqlite3_api;
+#endif
#include <string.h>
#include <assert.h>
#include <stdlib.h>
@@ -2450,7 +2454,7 @@
if( !zVal ){
return SQLITE_NOMEM;
- }else if( nVal==8 && 0==sqlite3_strnicmp(zVal, "optimize", 8) ){
+ }else if( nVal==8 && 0==strnicmp(zVal, "optimize", 8) ){
rc = fts3SegmentMerge(p, FTS3_SEGCURSOR_ALL);
if( rc==SQLITE_DONE ){
rc = SQLITE_OK;
@@ -2458,10 +2462,10 @@
sqlite3Fts3PendingTermsClear(p);
}
#ifdef SQLITE_TEST
- }else if( nVal>9 && 0==sqlite3_strnicmp(zVal, "nodesize=", 9) ){
+ }else if( nVal>9 && 0==strnicmp(zVal, "nodesize=", 9) ){
p->nNodeSize = atoi(&zVal[9]);
rc = SQLITE_OK;
- }else if( nVal>11 && 0==sqlite3_strnicmp(zVal, "maxpending=", 9) ){
+ }else if( nVal>11 && 0==strnicmp(zVal, "maxpending=", 9) ){
p->nMaxPendingData = atoi(&zVal[11]);
rc = SQLITE_OK;
#endif
--- sqlite3.orig/ext/fts3/fts3_aux.c 2011-04-12 11:44:56.000000000 +0200
+++ sqlite3/ext/fts3/fts3_aux.c 2011-04-13 08:16:17.000000000 +0200
@@ -15,6 +15,10 @@
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
#include "fts3Int.h"
+#include "sqlite3ext.h"
+#ifndef SQLITE_CORE
+extern const sqlite3_api_routines *sqlite3_api;
+#endif
#include <string.h>
#include <assert.h>
EOD
test "$VER3" = "3.6.21" -o "$VER3" = "3.6.22" -o "$VER3" = "3.6.23" \
-o "$VER3" = "3.6.23.1" -o "$VER3" = "3.7.0" -o "$VER3" = "3.7.0.1" \
-o "$VER3" = "3.7.1" -o "$VER3" = "3.7.2" -o "$VER3" = "3.7.3" \
&& patch -d sqlite3 -p1 <<'EOD'
--- sqlite3.orig/ext/fts3/fts3_snippet.c 2009-12-03 12:33:32.000000000 +0100
+++ sqlite3/ext/fts3/fts3_snippet.c 2010-01-05 08:03:51.000000000 +0100
@@ -14,6 +14,10 @@
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
#include "fts3Int.h"
+#include "sqlite3ext.h"
+#ifndef SQLITE_CORE
+extern const sqlite3_api_routines *sqlite3_api;
+#endif
#include <string.h>
#include <assert.h>
#include <ctype.h>
--- sqlite3.orig/ext/fts3/fts3_expr.c 2009-12-03 12:33:32.000000000 +0100
+++ sqlite3/ext/fts3/fts3_expr.c 2010-01-05 08:06:10.000000000 +0100
@@ -17,6 +17,11 @@
*/
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
+#include "sqlite3ext.h"
+#ifndef SQLITE_CORE
+extern const sqlite3_api_routines *sqlite3_api;
+#endif
+
/*
** By default, this module parses the legacy syntax that has been
** traditionally used by fts3. Or, if SQLITE_ENABLE_FTS3_PARENTHESIS
@@ -445,7 +450,7 @@
const char *zStr = pParse->azCol[ii];
int nStr = (int)strlen(zStr);
if( nInput>nStr && zInput[nStr]==':'
- && sqlite3_strnicmp(zStr, zInput, nStr)==0
+ && memcmp(zStr, zInput, nStr)==0
){
iCol = ii;
iColLen = (int)((zInput - z) + nStr + 1);
--- sqlite3.orig/ext/fts3/fts3_tokenizer.c 2009-12-07 17:38:46.000000000 +0100
+++ sqlite3/ext/fts3/fts3_tokenizer.c 2010-01-05 08:12:50.000000000 +0100
@@ -27,7 +27,7 @@
#include "sqlite3ext.h"
#ifndef SQLITE_CORE
- SQLITE_EXTENSION_INIT1
+extern const sqlite3_api_routines *sqlite3_api;
#endif
#include "fts3Int.h"
@@ -166,7 +166,7 @@
if( !z ){
zCopy = sqlite3_mprintf("simple");
}else{
- if( sqlite3_strnicmp(z, "tokenize", 8) || fts3IsIdChar(z[8])){
+ if( strnicmp(z, "tokenize", 8) || fts3IsIdChar(z[8])){
return SQLITE_OK;
}
zCopy = sqlite3_mprintf("%s", &z[8]);
EOD
test "$VER3" = "3.7.4" -o "$VER3" = "3.7.5" -o "$VER3" = "3.7.6" \
-o "$VER3" = "3.7.6.1" -o "$VER3" = "3.7.6.2" -o "$VER3" = "3.7.6.3" \
&& patch -d sqlite3 -p1 <<'EOD'
--- sqlite3.orig/ext/fts3/fts3_snippet.c 2009-12-03 12:33:32.000000000 +0100
+++ sqlite3/ext/fts3/fts3_snippet.c 2010-01-05 08:03:51.000000000 +0100
@@ -14,6 +14,10 @@
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
#include "fts3Int.h"
+#include "sqlite3ext.h"
+#ifndef SQLITE_CORE
+extern const sqlite3_api_routines *sqlite3_api;
+#endif
#include <string.h>
#include <assert.h>
#include <ctype.h>
--- sqlite3.orig/ext/fts3/fts3_tokenizer.c 2009-12-07 17:38:46.000000000 +0100
+++ sqlite3/ext/fts3/fts3_tokenizer.c 2010-01-05 08:12:50.000000000 +0100
@@ -27,7 +27,7 @@
#include "sqlite3ext.h"
#ifndef SQLITE_CORE
- SQLITE_EXTENSION_INIT1
+extern const sqlite3_api_routines *sqlite3_api;
#endif
#include "fts3Int.h"
--- sqlite3.orig/ext/fts3/fts3_expr.c 2009-12-03 12:33:32.000000000 +0100
+++ sqlite3/ext/fts3/fts3_expr.c 2010-01-05 08:06:10.000000000 +0100
@@ -17,6 +17,11 @@
*/
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
+#include "sqlite3ext.h"
+#ifndef SQLITE_CORE
+extern const sqlite3_api_routines *sqlite3_api;
+#endif
+
/*
** By default, this module parses the legacy syntax that has been
** traditionally used by fts3. Or, if SQLITE_ENABLE_FTS3_PARENTHESIS
@@ -445,7 +450,7 @@
const char *zStr = pParse->azCol[ii];
int nStr = (int)strlen(zStr);
if( nInput>nStr && zInput[nStr]==':'
- && sqlite3_strnicmp(zStr, zInput, nStr)==0
+ && memcmp(zStr, zInput, nStr)==0
){
iCol = ii;
iColLen = (int)((zInput - z) + nStr + 1);
--- sqlite3.orig/ext/fts3/fts3.c 2010-12-07 16:14:36.000000000 +0100
+++ sqlite3/ext/fts3/fts3.c 2010-12-16 11:59:02.000000000 +0100
@@ -702,8 +698,8 @@
sqlite3_tokenizer *pTokenizer = 0; /* Tokenizer for this table */
assert( strlen(argv[0])==4 );
- assert( (sqlite3_strnicmp(argv[0], "fts4", 4)==0 && isFts4)
- || (sqlite3_strnicmp(argv[0], "fts3", 4)==0 && !isFts4)
+ assert( (strnicmp(argv[0], "fts4", 4)==0 && isFts4)
+ || (strnicmp(argv[0], "fts3", 4)==0 && !isFts4)
);
nDb = (int)strlen(argv[1]) + 1;
@@ -732,7 +728,7 @@
/* Check if this is a tokenizer specification */
if( !pTokenizer
&& strlen(z)>8
- && 0==sqlite3_strnicmp(z, "tokenize", 8)
+ && 0==strnicmp(z, "tokenize", 8)
&& 0==sqlite3Fts3IsIdChar(z[8])
){
rc = sqlite3Fts3InitTokenizer(pHash, &z[9], &pTokenizer, pzErr);
@@ -744,8 +740,8 @@
rc = SQLITE_NOMEM;
goto fts3_init_out;
}
- if( nKey==9 && 0==sqlite3_strnicmp(z, "matchinfo", 9) ){
- if( strlen(zVal)==4 && 0==sqlite3_strnicmp(zVal, "fts3", 4) ){
+ if( nKey==9 && 0==strnicmp(z, "matchinfo", 9) ){
+ if( strlen(zVal)==4 && 0==strnicmp(zVal, "fts3", 4) ){
bNoDocsize = 1;
}else{
*pzErr = sqlite3_mprintf("unrecognized matchinfo: %s", zVal);
--- sqlite3.orig/ext/fts3/fts3_write.c 2010-12-16 12:08:45.000000000 +0100
+++ sqlite3/ext/fts3/fts3_write.c 2010-12-16 12:48:30.000000000 +0100
@@ -868,16 +868,16 @@
assert( pnBlob);
if( p->pSegments ){
- rc = sqlite3_blob_reopen(p->pSegments, iBlockid);
- }else{
- if( 0==p->zSegmentsTbl ){
- p->zSegmentsTbl = sqlite3_mprintf("%s_segments", p->zName);
- if( 0==p->zSegmentsTbl ) return SQLITE_NOMEM;
- }
- rc = sqlite3_blob_open(
- p->db, p->zDb, p->zSegmentsTbl, "block", iBlockid, 0, &p->pSegments
- );
+ sqlite3_blob_close(p->pSegments);
+ p->pSegments = 0;
}
+ if( 0==p->zSegmentsTbl ){
+ p->zSegmentsTbl = sqlite3_mprintf("%s_segments", p->zName);
+ if( 0==p->zSegmentsTbl ) return SQLITE_NOMEM;
+ }
+ rc = sqlite3_blob_open(
+ p->db, p->zDb, p->zSegmentsTbl, "block", iBlockid, 0, &p->pSegments
+ );
if( rc==SQLITE_OK ){
int nByte = sqlite3_blob_bytes(p->pSegments);
EOD
# patch: FTS3 again, for SQLite3 >= 3.6.8
test "$VER3" = "3.6.8" -o "$VER3" = "3.6.9" -o "$VER3" = "3.6.10" \
-o "$VER3" = "3.6.11" -o "$VER3" = "3.6.12" -o "$VER3" = "3.6.13" \
-o "$VER3" = "3.6.14" -o "$VER3" = "3.6.14.1" -o "$VER3" = "3.6.14.2" \
-o "$VER3" = "3.6.15" -o "$VER3" = "3.6.16" -o "$VER3" = "3.6.17" \
-o "$VER3" = "3.6.18" -o "$VER3" = "3.6.19" -o "$VER3" = "3.6.20" && \
patch -d sqlite3 -p1 <<'EOD'
--- sqlite3.orig/ext/fts3/fts3_expr.c 2009-01-01 15:06:13.000000000 +0100
+++ sqlite3/ext/fts3/fts3_expr.c 2009-01-14 09:55:13.000000000 +0100
@@ -57,6 +57,12 @@
#define SQLITE_FTS3_DEFAULT_NEAR_PARAM 10
#include "fts3_expr.h"
+
+#include "sqlite3ext.h"
+#ifndef SQLITE_CORE
+extern const sqlite3_api_routines *sqlite3_api;
+#endif
+
#include "sqlite3.h"
#include <ctype.h>
#include <string.h>
EOD
test "$VER3" = "3.6.17" -o "$VER3" = "3.6.18" -o "$VER3" = "3.6.19" \
-o "$VER3" = "3.6.20" && patch -d sqlite3 -p1 <<'EOD'
--- sqlite3.orig/ext/fts3/fts3_expr.c 2009-01-01 15:06:13.000000000 +0100
+++ sqlite3/ext/fts3/fts3_expr.c 2009-01-14 09:55:13.000000000 +0100
@@ -428,7 +428,7 @@
const char *zStr = pParse->azCol[ii];
int nStr = strlen(zStr);
if( nInput>nStr && zInput[nStr]==':'
- && sqlite3_strnicmp(zStr, zInput, nStr)==0
+ && memcmp(zStr, zInput, nStr)==0
){
iCol = ii;
iColLen = ((zInput - z) + nStr + 1);
EOD
# patch: compile fix for rtree as extension module
test "$VER3" != "3.8.0" -a "$VER3" != "3.8.1" -a "$VER3" != "3.8.2" \
-a "$VER3" != "3.8.3" -a "$VER3" != "3.8.4" -a "$VER3" != "3.8.4.1" \
-a "$VER3" != "3.8.4.2" -a "$VER3" != "3.8.5" -a "$VER3" != "3.8.6" \
-a "$VER3" != "3.8.7" -a "$VER3" != "3.8.8" -a "$VER3" != "3.8.9" \
-a "$VER3" != "3.8.10" -a "$VER3" != "3.8.11" -a "$VER3" != "3.9.0" \
-a "$VER3" != "3.9.1" -a "$VER3" != "3.9.2" -a "$VER3" != "3.10.0" \
-a "$VER3" != "3.10.2" -a "$VER3" != "3.12.2" -a "$VER3" != "3.13.0" \
-a "$VER3" != "3.14.0" -a "$VER3" != "3.14.1" -a "$VER3" != "3.15.0" \
-a "$VER3" != "3.15.1" -a "$VER3" != "3.15.2" -a "$VER3" != "3.19.3" \
-a "$VER3" != "3.22.0" -a "$VER3" != "3.32.2" -a "$VER3" != "3.32.3" \
-a "$VER3" != "3.42.0" -a "$VER3" != "3.43.0" -a "$VER3" != "3.43.2" \
&& patch -d sqlite3 -p1 <<'EOD'
--- sqlite3.orig/ext/rtree/rtree.c 2008-07-16 16:43:35.000000000 +0200
+++ sqlite3/ext/rtree/rtree.c 2008-07-17 08:59:53.000000000 +0200
@@ -2812,7 +2812,7 @@
return rc;
}
-#if !SQLITE_CORE
+#ifndef SQLITE_CORE
int sqlite3_extension_init(
sqlite3 *db,
char **pzErrMsg,
EOD
# patch: compile fix for rtree as extension module
test "$VER3" = "3.7.3" -o "$VER3" = "3.7.4" -o "$VER3" = "3.7.5" \
-o "$VER3" = "3.7.6" \
-o "$VER3" = "3.7.6.1" -o "$VER3" = "3.7.6.2" -o "$VER3" = "3.7.6.3" \
-o "$VER3" = "3.7.7" -o "$VER3" = "3.7.7.1" -o "$VER3" = "3.7.8" \
-o "$VER3" = "3.7.9" -o "$VER3" = "3.7.10" -o "$VER3" = "3.7.11" \
-o "$VER3" = "3.7.12" -o "$VER3" = "3.7.12.1" -o "$VER3" = "3.7.13" \
-o "$VER3" = "3.7.14" -o "$VER3" = "3.7.14.1" -o "$VER3" = "3.7.15" \
-o "$VER3" = "3.7.15.1" -o "$VER3" = "3.7.15.2" -o "$VER3" = "3.7.16" \
-o "$VER3" = "3.7.16.1" -o "$VER3" = "3.7.16.2" -o "$VER3" = "3.7.17" \
&& patch -d sqlite3 -p1 <<'EOD'
--- sqlite3.orig/ext/rtree/rtree.c 2010-10-16 10:53:54.000000000 +0200
+++ sqlite3/ext/rtree/rtree.c 2010-10-16 11:12:32.000000000 +0200
@@ -3193,6 +3193,8 @@
return rc;
}
+#ifdef SQLITE_CORE
+
/*
** A version of sqlite3_free() that can be used as a callback. This is used
** in two places - as the destructor for the blob value returned by the
@@ -3257,6 +3259,8 @@
);
}
+#endif
+
#ifndef SQLITE_CORE
int sqlite3_extension_init(
sqlite3 *db,
EOD
# patch: fix rtree to be loadable as extension module
test "$VER3" = "3.32.2" -o "$VER3" = "3.32.3" -o "$VER3" = "3.42.0" \
-o "$VER3" = "3.43.0" -o "$VER3" = "3.43.2" \
&& perl -pi -e 's/sqlite3_rtree_init/sqlite3_extension_init/g' \
sqlite3/ext/rtree/rtree.c
# patch: .read shell command
test "$VER3" = "3.7.6.1" -o "$VER3" = "3.7.6.2" -o "$VER3" = "3.7.6.3" \
-o "$VER3" = "3.7.7" -o "$VER3" = "3.7.7.1" -o "$VER3" = "3.7.8" \
-o "$VER3" = "3.7.9" -o "$VER3" = "3.7.10" -o "$VER3" = "3.7.11" \
-o "$VER3" = "3.7.12" -o "$VER3" = "3.7.12.1" -o "$VER3" = "3.7.13" \
-o "$VER3" = "3.7.14" -o "$VER3" = "3.7.14.1" \
&& patch -d sqlite3 -p1 <<'EOD'
--- sqlite3.orig/src/shell.c 2011-05-19 15:34:57.000000000 +0200
+++ sqlite3/src/shell.c 2011-06-09 13:36:13.000000000 +0200
@@ -1957,6 +1957,7 @@
}else{
rc = process_input(p, alt);
fclose(alt);
+ if( rc ) rc = 1;
}
}else
EOD
# patch: FTS3 for 3.7.7 plus missing APIs in sqlite3ext.h/loadext.c
test "$VER3" = "3.7.7" -o "$VER3" = "3.7.7.1" -o "$VER3" = "3.7.8" \
-o "$VER3" = "3.7.9" -o "$VER3" = "3.7.10" -o "$VER3" = "3.7.11" \
-o "$VER3" = "3.7.12" -o "$VER3" = "3.7.12.1" -o "$VER3" = "3.7.13" \
-o "$VER3" = "3.7.14" -o "$VER3" = "3.7.14.1" -o "$VER3" = "3.7.15" \
-o "$VER3" = "3.7.15.1" -o "$VER3" = "3.7.15.2" -o "$VER3" = "3.7.16" \
-o "$VER3" = "3.7.16.1" -o "$VER3" = "3.7.16.2" -o "$VER3" = "3.7.17" \
-o "$VER3" = "3.8.0" -o "$VER3" = "3.8.1" -o "$VER3" = "3.8.2" \
-o "$VER3" = "3.8.3" -o "$VER3" = "3.8.4" -o "$VER3" = "3.8.4.1" \
-o "$VER3" = "3.8.4.2" -o "$VER3" = "3.8.5" -o "$VER3" = "3.8.6" \
-o "$VER3" = "3.8.7" -o "$VER3" = "3.8.8" -o "$VER3" = "3.8.9" \
-o "$VER3" = "3.8.10" -o "$VER3" = "3.8.11" -o "$VER3" = "3.9.0" \
-o "$VER3" = "3.9.1" -o "$VER3" = "3.9.2" -o "$VER3" = "3.10.0" \
-o "$VER3" = "3.10.2" -o "$VER3" = "3.12.2" -o "$VER3" = "3.13.0" \
-o "$VER3" = "3.14.0" -o "$VER3" = "3.14.1" -o "$VER3" = "3.15.0" \
-o "$VER3" = "3.15.1" -o "$VER3" = "3.15.2" -o "$VER3" = "3.19.3" \
-o "$VER3" = "3.22.0" -o "$VER3" = "3.32.2" -o "$VER3" = "3.32.3" \
-o "$VER3" = "3.42.0" -o "$VER3" = "3.43.0" -o "$VER3" = "3.43.2" \
&& patch -d sqlite3 -p1 <<'EOD'
--- sqlite3.orig/ext/fts3/fts3_aux.c 2011-06-24 09:06:08.000000000 +0200
+++ sqlite3/ext/fts3/fts3_aux.c 2011-06-25 06:44:08.000000000 +0200
@@ -14,6 +14,10 @@
#include "fts3Int.h"
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
+#include "sqlite3ext.h"
+#ifndef SQLITE_CORE
+extern const sqlite3_api_routines *sqlite3_api;
+#endif
#include <string.h>
#include <assert.h>
EOD
test "$VER3" = "3.7.7" -o "$VER3" = "3.7.7.1" \
&& patch -d sqlite3 -p1 <<'EOD'
--- sqlite3.orig/ext/fts3/fts3.c 2011-06-24 09:06:08.000000000 +0200
+++ sqlite3/ext/fts3/fts3.c 2011-06-25 06:48:49.000000000 +0200
@@ -295,10 +295,6 @@
#include "fts3Int.h"
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
-#if defined(SQLITE_ENABLE_FTS3) && !defined(SQLITE_CORE)
-# define SQLITE_CORE 1
-#endif
-
#include <assert.h>
#include <stdlib.h>
#include <stddef.h>
@@ -3136,7 +3132,7 @@
return rc;
}
-#if !SQLITE_CORE
+#ifndef SQLITE_CORE
int sqlite3_extension_init(
sqlite3 *db,
char **pzErrMsg,
EOD
test "$VER3" = "3.7.8" -o "$VER3" = "3.7.9" -o "$VER3" = "3.7.10" \
-o "$VER3" = "3.7.11" -o "$VER3" = "3.7.12" -o "$VER3" = "3.7.12.1" \
-o "$VER3" = "3.7.13" -o "$VER3" = "3.7.14" -o "$VER3" = "3.7.14.1" \
-o "$VER3" = "3.7.15" -o "$VER3" = "3.7.15.1" -o "$VER3" = "3.7.15.2" \
-o "$VER3" = "3.7.16" -o "$VER3" = "3.7.16.1" -o "$VER3" = "3.7.16.2" \
-o "$VER3" = "3.7.17" -o "$VER3" = "3.8.0" -o "$VER3" = "3.8.1" \
-o "$VER3" = "3.8.2" -o "$VER3" = "3.8.3" -o "$VER3" = "3.8.4" \
-o "$VER3" = "3.8.4.1" -o "$VER3" = "3.8.4.2" -o "$VER3" = "3.8.5" \
-o "$VER3" = "3.8.6" -o "$VER3" = "3.8.7" -o "$VER3" = "3.8.8" \
-o "$VER3" = "3.8.9" -o "$VER3" = "3.8.10" -o "$VER3" = "3.8.11" \
-o "$VER3" = "3.9.0" -o "$VER3" = "3.9.1" -o "$VER3" = "3.9.2" \
-o "$VER3" = "3.10.0" -o "$VER3" = "3.10.2" -o "$VER3" = "3.12.2" \
-o "$VER3" = "3.13.0" -o "$VER3" = "3.14.0" -o "$VER3" = "3.14.1" \
-o "$VER3" = "3.15.0" -o "$VER3" = "3.15.1" -o "$VER3" = "3.15.2" \
-o "$VER3" = "3.19.3" -o "$VER3" = "3.22.0" -o "$VER3" = "3.32.2" \
-o "$VER3" = "3.32.3" -o "$VER3" = "3.42.0" -o "$VER3" = "3.43.0" \
-o "$VER3" = "3.43.2" \
&& patch -d sqlite3 -p1 <<'EOD'
--- sqlite3.orig/ext/fts3/fts3.c 2011-09-19 20:46:52.000000000 +0200
+++ sqlite3/ext/fts3/fts3.c 2011-09-20 09:47:40.000000000 +0200
@@ -295,10 +295,6 @@
#include "fts3Int.h"
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
-#if defined(SQLITE_ENABLE_FTS3) && !defined(SQLITE_CORE)
-# define SQLITE_CORE 1
-#endif
-
#include <assert.h>
#include <stdlib.h>
#include <stddef.h>
@@ -4826,7 +4822,7 @@
}
}
-#if !SQLITE_CORE
+#ifndef SQLITE_CORE
/*
** Initialize API pointer table, if required.
*/
EOD
test "$VER3" = "3.7.7" -o "$VER3" = "3.7.7.1" -o "$VER3" = "3.7.8" \
-o "$VER3" = "3.7.9" -o "$VER3" = "3.7.10" -o "$VER3" = "3.7.11" \
-o "$VER3" = "3.7.12" -o "$VER3" = "3.7.12.1" -o "$VER3" = "3.7.13" \
-o "$VER3" = "3.7.14" -o "$VER3" = "3.7.14.1" -o "$VER3" = "3.7.15" \
-o "$VER3" = "3.7.15.1" -o "$VER3" = "3.7.15.2" -o "$VER3" = "3.7.16" \
-o "$VER3" = "3.7.16.1" -o "$VER3" = "3.7.16.2" -o "$VER3" = "3.7.17" \
-o "$VER3" = "3.8.0" -o "$VER3" = "3.8.1" -o "$VER3" = "3.8.2" \
-o "$VER3" = "3.8.3" -o "$VER3" = "3.8.4" -o "$VER3" = "3.8.4.1" \
-o "$VER3" = "3.8.4.2" -o "$VER3" = "3.8.5" -o "$VER3" = "3.8.6" \
-o "$VER3" = "3.8.7" -o "$VER3" = "3.8.8" -o "$VER3" = "3.8.9" \
-o "$VER3" = "3.8.10" -o "$VER3" = "3.8.11" -o "$VER3" = "3.9.0" \
-o "$VER3" = "3.9.1" -o "$VER3" = "3.9.2" -o "$VER3" = "3.10.0" \
-o "$VER3" = "3.10.2" -o "$VER3" = "3.12.2" -o "$VER3" = "3.13.0" \
-o "$VER3" = "3.14.0" -o "$VER3" = "3.14.1" -o "$VER3" = "3.15.0" \
-o "$VER3" = "3.15.1" -o "$VER3" = "3.15.2" -o "$VER3" = "3.19.3" \
-o "$VER3" = "3.22.0" -o "$VER3" = "3.32.2" -o "$VER3" = "3.32.3" \
-o "$VER3" = "3.42.0" -o "$VER3" = "3.43.0" -o "$VER3" = "3.43.2" \
&& patch -d sqlite3 -p1 <<'EOD'
--- sqlite3.orig/ext/fts3/fts3_expr.c 2011-06-24 09:06:08.000000000 +0200
+++ sqlite3/ext/fts3/fts3_expr.c 2011-06-25 06:47:00.000000000 +0200
@@ -18,6 +18,11 @@
#include "fts3Int.h"
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
+#include "sqlite3ext.h"
+#ifndef SQLITE_CORE
+extern const sqlite3_api_routines *sqlite3_api;
+#endif
+
/*
** By default, this module parses the legacy syntax that has been
** traditionally used by fts3. Or, if SQLITE_ENABLE_FTS3_PARENTHESIS
--- sqlite3.orig/ext/fts3/fts3_snippet.c 2011-06-24 09:06:08.000000000 +0200
+++ sqlite3/ext/fts3/fts3_snippet.c 2011-06-25 06:45:47.000000000 +0200
@@ -13,7 +13,10 @@
#include "fts3Int.h"
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
-
+#include "sqlite3ext.h"
+#ifndef SQLITE_CORE
+extern const sqlite3_api_routines *sqlite3_api;
+#endif
#include <string.h>
#include <assert.h>
EOD
test "$VER3" = "3.7.7" -o "$VER3" = "3.7.7.1" \
&& patch -d sqlite3 -p1 <<'EOD'
--- sqlite3.orig/ext/fts3/fts3_tokenizer.c 2011-06-24 09:06:08.000000000 +0200
+++ sqlite3/ext/fts3/fts3_tokenizer.c 2011-06-25 06:50:19.000000000 +0200
@@ -25,7 +25,7 @@
*/
#include "sqlite3ext.h"
#ifndef SQLITE_CORE
- SQLITE_EXTENSION_INIT1
+extern const sqlite3_api_routines *sqlite3_api;
#endif
#include "fts3Int.h"
--- sqlite3.orig/ext/fts3/fts3_write.c 2011-06-24 09:06:08.000000000 +0200
+++ sqlite3/ext/fts3/fts3_write.c 2011-06-25 06:45:05.000000000 +0200
@@ -20,6 +20,10 @@
#include "fts3Int.h"
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
+#include "sqlite3ext.h"
+#ifndef SQLITE_CORE
+extern const sqlite3_api_routines *sqlite3_api;
+#endif
#include <string.h>
#include <assert.h>
#include <stdlib.h>
--- sqlite3.orig/src/sqlite3ext.h 2011-06-24 09:06:08.000000000 +0200
+++ sqlite3/src/sqlite3ext.h 2011-06-25 07:28:06.000000000 +0200
@@ -212,6 +212,9 @@
int (*wal_autocheckpoint)(sqlite3*,int);
int (*wal_checkpoint)(sqlite3*,const char*);
void *(*wal_hook)(sqlite3*,int(*)(void*,sqlite3*,const char*,int),void*);
+ int (*blob_reopen)(sqlite3_blob*,sqlite3_int64);
+ int (*vtab_config)(sqlite3*,int op,...);
+ int (*vtab_on_conflict)(sqlite3*);
};
/*
@@ -412,6 +415,9 @@
#define sqlite3_wal_autocheckpoint sqlite3_api->wal_autocheckpoint
#define sqlite3_wal_checkpoint sqlite3_api->wal_checkpoint
#define sqlite3_wal_hook sqlite3_api->wal_hook
+#define sqlite3_blob_reopen sqlite3_api->blob_reopen
+#define sqlite3_vtab_config sqlite3_api->vtab_config
+#define sqlite3_vtab_on_conflict sqlite3_api->vtab_on_conflict
#endif /* SQLITE_CORE */
#define SQLITE_EXTENSION_INIT1 const sqlite3_api_routines *sqlite3_api = 0;
--- sqlite3.orig/src/loadext.c 2011-06-24 09:06:08.000000000 +0200
+++ sqlite3/src/loadext.c 2011-06-25 07:29:59.000000000 +0200
@@ -84,6 +84,8 @@
# define sqlite3_create_module 0
# define sqlite3_create_module_v2 0
# define sqlite3_declare_vtab 0
+# define sqlite3_vtab_config 0
+# define sqlite3_vtab_on_conflict 0
#endif
#ifdef SQLITE_OMIT_SHARED_CACHE
@@ -107,6 +109,7 @@
#define sqlite3_blob_open 0
#define sqlite3_blob_read 0
#define sqlite3_blob_write 0
+#define sqlite3_blob_reopen 0
#endif
/*
@@ -372,6 +375,18 @@
0,
0,
#endif
+#ifndef SQLITE_OMIT_INCRBLOB
+ sqlite3_blob_reopen,
+#else
+ 0,
+#endif
+#ifndef SQLITE_OMIT_VIRTUALTABLE
+ sqlite3_vtab_config,
+ sqlite3_vtab_on_conflict,
+#else
+ 0,
+ 0,
+#endif
};
/*
EOD
test "$VER3" = "3.7.11" -o "$VER3" = "3.7.12" -o "$VER3" = "3.7.12.1" \
-o "$VER3" = "3.7.13" -o "$VER3" = "3.7.14" -o "$VER3" = "3.7.14.1" \
-o "$VER3" = "3.7.15" -o "$VER3" = "3.7.15.1" -o "$VER3" = "3.7.15.2" \
&& patch -d sqlite3 -p1 <<'EOD'
--- sqlite3.orig/src/sqlite3ext.h 2012-03-22 20:13:33.000000000 +0100
+++ sqlite3/src/sqlite3ext.h 2012-03-22 20:13:57.000000000 +0100
@@ -236,6 +236,7 @@
int (*blob_reopen)(sqlite3_blob*,sqlite3_int64);
int (*vtab_config)(sqlite3*,int op,...);
int (*vtab_on_conflict)(sqlite3*);
+ int (*stricmp)(const char*,const char*);
};
/*
@@ -439,6 +440,7 @@
#define sqlite3_blob_reopen sqlite3_api->blob_reopen
#define sqlite3_vtab_config sqlite3_api->vtab_config
#define sqlite3_vtab_on_conflict sqlite3_api->vtab_on_conflict
+#define sqlite3_stricmp sqlite3_api->stricmp
#endif /* SQLITE_CORE */
#define SQLITE_EXTENSION_INIT1 const sqlite3_api_routines *sqlite3_api = 0;
--- sqlite3.orig/src/loadext.c 2012-03-20 15:20:13.000000000 +0100
+++ sqlite3/src/loadext.c 2012-03-22 20:16:24.000000000 +0100
@@ -378,6 +378,7 @@
sqlite3_blob_reopen,
sqlite3_vtab_config,
sqlite3_vtab_on_conflict,
+ sqlite3_stricmp,
};
/*
EOD
test "$VER3" = "3.8.0" -o "$VER3" = "3.8.1" -o "$VER3" = "3.8.2" \
-o "$VER3" = "3.8.3" -o "$VER3" = "3.8.4" -o "$VER3" = "3.8.4.1" \
-o "$VER3" = "3.8.4.2" -o "$VER3" = "3.8.5" -o "$VER3" = "3.8.6" \
-o "$VER3" = "3.8.7" -o "$VER3" = "3.8.8" -o "$VER3" = "3.8.9" \
-o "$VER3" = "3.8.10" -o "$VER3" = "3.8.11" -o "$VER3" = "3.9.0" \
-o "$VER3" = "3.9.1" -o "$VER3" = "3.9.2" -o "$VER3" = "3.10.0" \
-o "$VER3" = "3.10.2" -o "$VER3" = "3.12.2" -o "$VER3" = "3.13.0" \
-o "$VER3" = "3.14.0" -o "$VER3" = "3.14.1" -o "$VER3" = "3.15.0" \
-o "$VER3" = "3.15.1" -o "$VER3" = "3.15.2" -o "$VER3" = "3.19.3" \
-o "$VER3" = "3.22.0" \
&& patch -d sqlite3 -p1 <<'EOD'
--- sqlite3.orig/src/loadext.c 2013-09-16 06:56:48.000000000 +0200
+++ sqlite3/src/loadext.c 2013-09-16 06:58:14.000000000 +0200
@@ -495,7 +495,12 @@
memcpy(zAltEntry, "sqlite3_", 8);
+#if SQLITE_OS_WIN
+ for(iFile=ncFile-1; iFile>=0 && zFile[iFile]!='/' && zFile[iFile]!='\\'; iFile--){}
+#else
for(iFile=ncFile-1; iFile>=0 && zFile[iFile]!='/'; iFile--){}
+#endif
iFile++;
- if( sqlite3_strnicmp(zFile+iFile, "lib", 3)==0 ) iFile += 3;
+ if( sqlite3_strnicmp(zFile+iFile, "sqlite3_mod_", 12)==0 ) iFile += 12;
+ else if( sqlite3_strnicmp(zFile+iFile, "lib", 3)==0 ) iFile += 3;
for(iEntry=8; (c = zFile[iFile])!=0 && c!='.'; iFile++){
if( sqlite3Isalpha(c) ){
zAltEntry[iEntry++] = (char)sqlite3UpperToLower[(unsigned)c];
EOD
test "$VER3" = "3.32.2" -o "$VER3" = "3.32.3" -o "$VER3" = "3.42.0" \
-o "$VER3" = "3.43.0" -o "$VER3" = "3.43.2" \
&& patch -d sqlite3 -p1 <<'EOD'
--- sqlite3.orig/src/loadext.c 2020-06-04 16:01:10.000000000 +0200
+++ sqlite3/src/loadext.c 2020-06-12 05:47:05.000000000 +0200
@@ -591,7 +591,8 @@
memcpy(zAltEntry, "sqlite3_", 8);
for(iFile=ncFile-1; iFile>=0 && !DirSep(zFile[iFile]); iFile--){}
iFile++;
- if( sqlite3_strnicmp(zFile+iFile, "lib", 3)==0 ) iFile += 3;
+ if( sqlite3_strnicmp(zFile+iFile, "sqlite3_mod", 12)==0 ) iFile += 12;
+ else if( sqlite3_strnicmp(zFile+iFile, "lib", 3)==0 ) iFile += 3;
for(iEntry=8; (c = zFile[iFile])!=0 && c!='.'; iFile++){
if( sqlite3Isalpha(c) ){
zAltEntry[iEntry++] = (char)sqlite3UpperToLower[(unsigned)c];
EOD
# revert FTS3 initializer name, would work when sqlite3_fts_init
test "$VER3" = "3.8.2" -o "$VER3" = "3.8.3" -o "$VER3" = "3.8.4" \
-o "$VER3" = "3.8.4.1" -o "$VER3" = "3.8.4.2" -o "$VER3" = "3.8.5" \
-o "$VER3" = "3.8.6" -o "$VER3" = "3.8.7" -o "$VER3" = "3.8.8" \
-o "$VER3" = "3.8.9" -o "$VER3" = "3.8.10" -o "$VER3" = "3.8.11" \
-o "$VER3" = "3.9.0" -o "$VER3" = "3.9.1" -o "$VER3" = "3.9.2" \
-o "$VER3" = "3.10.0" -o "$VER3" = "3.10.2" -o "$VER3" = "3.12.2" \
-o "$VER3" = "3.13.0" -o "$VER3" = "3.14.0" -o "$VER3" = "3.14.1" \
-o "$VER3" = "3.15.0" -o "$VER3" = "3.15.1" -o "$VER3" = "3.15.2" \
-o "$VER3" = "3.19.3" -o "$VER3" = "3.22.0" -o "$VER3" = "3.32.2" \
-o "$VER3" = "3.32.3" -o "$VER3" = "3.42.0" -o "$VER3" = "3.43.0" \
-o "$VER3" = "3.43.2" \
&& patch -d sqlite3 -p1 <<'EOD'
--- sqlite3.orig/ext/fts3/fts3.c 2014-03-26 10:26:28.000000000 +0100
+++ sqlite3/ext/fts3/fts3.c 2014-03-26 16:54:39.000000000 +0100
@@ -5747,7 +5747,7 @@
#ifdef _WIN32
__declspec(dllexport)
#endif
-int sqlite3_fts3_init(
+int sqlite3_extension_init(
sqlite3 *db,
char **pzErrMsg,
const sqlite3_api_routines *pApi
EOD
# missing windows.h for DWORD, HANDLE in threads.c
test "$VER3" = "3.8.7" -o "$VER3" = "3.8.8" -o "$VER3" = "3.8.9" \
-o "$VER3" = "3.8.10" -o "$VER3" = "3.8.11" -o "$VER3" = "3.9.0" \
-o "$VER3" = "3.9.1" -o "$VER3" = "3.9.2" -o "$VER3" = "3.10.0" \
-o "$VER3" = "3.10.2" -o "$VER3" = "3.12.2" -o "$VER3" = "3.13.0" \
-o "$VER3" = "3.14.0" -o "$VER3" = "3.14.1" -o "$VER3" = "3.15.0" \
-o "$VER3" = "3.15.1" -o "$VER3" = "3.15.2" -o "$VER3" = "3.19.3" \
-o "$VER3" = "3.22.0" -o "$VER3" = "3.32.2" -o "$VER3" = "3.32.3" \
-o "$VER3" = "3.42.0" -o "$VER3" = "3.43.0" -o "$VER3" = "3.43.2" \
&& patch -d sqlite3 -p1 <<'EOD'
--- sqlite3.orig/src/threads.c 2014-10-17 13:38:27.000000000 +0200
+++ sqlite3/src/threads.c 2014-10-26 13:40:26.000000000 +0100
@@ -101,6 +101,7 @@
#if SQLITE_OS_WIN && !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && SQLITE_THREADSAFE>0
#define SQLITE_THREADS_IMPLEMENTED 1 /* Prevent the single-thread code below */
+#include <windows.h>
#include <process.h>
/* A running thread */
EOD
# tcl8.4 compatibility for mkfts5c.tcl
test "$VER3" = "3.9.0" -o "$VER3" = "3.9.1" -o "$VER3" = "3.9.2" \
-o "$VER3" = "3.10.0" -o "$VER3" = "3.10.2" -o "$VER3" = "3.12.2" \
-o "$VER3" = "3.13.0" -o "$VER3" = "3.14.0" -o "$VER3" = "3.14.1" \
-o "$VER3" = "3.15.0" -o "$VER3" = "3.15.1" -o "$VER3" = "3.15.2" \
-o "$VER3" = "3.19.3" -o "$VER3" = "3.22.0" -o "$VER3" = "3.32.2" \
-o "$VER3" = "3.32.3" \
&& patch sqlite3/ext/fts5/tool/mkfts5c.tcl <<'EOD'
--- mkfts5c.tcl.orig 2015-10-14 14:53:26.000000000 +0200
+++ mkfts5c.tcl 2015-10-15 08:19:25.000000000 +0200
@@ -60,7 +60,8 @@
set L [split [readfile [file join $top manifest]]]
set date [lindex $L [expr [lsearch -exact $L D]+1]]
- set date [string range $date 0 [string last . $date]-1]
+ set dend [expr [string last . $date]-1]
+ set date [string range $date 0 $dend]
set date [string map {T { }} $date]
return "fts5: $date $uuid"
EOD
# tcl8.4 compatibility for some tools
test "$VER3" = "3.10.0" -o "$VER3" = "3.10.2" -o "$VER3" = "3.12.2" \
-o "$VER3" = "3.13.0" -o "$VER3" = "3.14.0" -o "$VER3" = "3.14.1" \
-o "$VER3" = "3.15.0" -o "$VER3" = "3.15.1" -o "$VER3" = "3.15.2" \
-o "$VER3" = "3.19.3" -o "$VER3" = "3.22.0" \
&& perl -pi -e 's/ rb\]/ r\]/g' sqlite3/tool/mkopcodec.tcl \
sqlite3/tool/tostr.tcl sqlite3/tool/addopcodes.tcl
test "$VER3" = "3.32.2" -o "$VER3" = "3.32.3" -o "$VER3" = "3.42.0" \
-o "$VER3" = "3.43.0" -o "$VER3" = "3.43.2" \
&& perl -pi -e 's/ rb\]/ r\]/g' sqlite3/tool/mkopcodec.tcl \
sqlite3/tool/mkccode.tcl
echo "===================="
echo "Preparing TinyCC ..."
echo "===================="
( $notcc && echo '*** skipped (NO_TCCEXT)' ) || true
$notcc || test -r tcc-${TCCVER}.tar.bz2 || \
wget -c http://download.savannah.gnu.org/releases/tinycc/tcc-${TCCVER}.tar.bz2
$notcc || test -r tcc-${TCCVER}.tar.bz2 || exit 1
$notcc || rm -rf tcc tcc-${TCCVER}
$notcc || tar xjf tcc-${TCCVER}.tar.bz2
$notcc || ln -sf tcc-${TCCVER} tcc
$notcc || patch -d tcc -p1 < tcc-${TCCVER}.patch
echo "========================"
echo "Cleanup before build ..."
echo "========================"
make -f Makefile.mingw-cross clean
$notv2 || make -C sqlite -f ../mf-sqlite.mingw-cross clean
make -C sqlite3 -f ../mf-sqlite3.mingw-cross clean
make -C sqlite3 -f ../mf-sqlite3fts.mingw-cross clean
make -C sqlite3 -f ../mf-sqlite3rtree.mingw-cross clean
make -f mf-sqlite3extfunc.mingw-cross clean
echo "============================="
echo "Building SQLite 2 ... ISO8859"
echo "============================="
( $nov2 && echo '*** skipped (NO_SQLITE2)' ) || true
$nov2 || make -C sqlite -f ../mf-sqlite.mingw-cross all
if test -n "$SQLITE_DLLS" ; then
$nov2 || make -C sqlite -f ../mf-sqlite.mingw-cross sqlite.dll
fi
echo "================="
echo "Building zlib ..."
echo "================="
make -C zlib -f ../mf-zlib.mingw-cross all
echo "====================="
echo "Building SQLite 3 ..."
echo "====================="
make -C sqlite3 -f ../mf-sqlite3.mingw-cross all
test -r sqlite3/tool/mksqlite3c.tcl && \
make -C sqlite3 -f ../mf-sqlite3.mingw-cross sqlite3.c
if test -r sqlite3/sqlite3.c -a -f "$WITH_SEE" ; then
cat sqlite3/sqlite3.c "$WITH_SEE" >sqlite3.c
ADD_CFLAGS="$ADD_CFLAGS -DSQLITE_HAS_CODEC=1"
ADD_CFLAGS="$ADD_CFLAGS -DSQLITE_ACTIVATION_KEY=\\\"$SEE_KEY\\\""
ADD_CFLAGS="$ADD_CFLAGS -DSEEEXT=\\\"$SEEEXT\\\""
ADD_CFLAGS="$ADD_CFLAGS -DSQLITE_API=static -DWIN32=1 -DNDEBUG=1 -DNO_TCL"
ADD_CFLAGS="$ADD_CFLAGS -DTHREADSAFE=1"
ADD_CFLAGS="$ADD_CFLAGS -DSQLITE_DLL=1 -DSQLITE_THREADSAFE=1"
ADD_CFLAGS="$ADD_CFLAGS -DSQLITE_OS_WIN=1 -DSQLITE_ASCII=1"
ADD_CFLAGS="$ADD_CFLAGS -DSQLITE_SOUNDEX=1"
ADD_CFLAGS="$ADD_CFLAGS -DSQLITE_ENABLE_COLUMN_METADATA=1"
ADD_CFLAGS="$ADD_CFLAGS -DWITHOUT_SHELL=1"
export ADD_CFLAGS
ADD_NSIS="$ADD_NSIS -DWITHOUT_SQLITE3_EXE"
unset SQLITE3_A10N_O
unset SQLITE3_EXE
fi
test "$VER3" = "3.8.6" -o "$VER3" = "3.8.7" -o "$VER3" = "3.8.8" \
-o "$VER3" = "3.8.9" -o "$VER3" = "3.8.10" \
&& patch sqlite3/sqlite3.c <<'EOD'
--- sqlite3.orig/sqlite3.c 2014-09-14 15:02:38.000000000 +0200
+++ sqlite3/sqlite3.c 2014-09-14 15:03:02.000000000 +0200
@@ -121057,7 +121057,7 @@
#if defined(_WIN32) || defined(WIN32)
# include <io.h>
-/* # include <fcntl.h> */
+# include <fcntl.h>
#define isatty(h) _isatty(h)
#ifndef access
# define access(f,m) _access((f),(m))
EOD
test "$VER3" = "3.8.11" -o "$VER3" = "3.9.0" -o "$VER3" = "3.9.1" \
-o "$VER3" = "3.9.2" -o "$VER3" = "3.10.0" -o "$VER3" = "3.10.2" \
-o "$VER3" = "3.12.2" -o "$VER3" = "3.13.0" -o "$VER3" = "3.14.0" \
-o "$VER3" = "3.14.1" -o "$VER3" = "3.15.0" -o "$VER3" = "3.15.1" \
-o "$VER3" = "3.15.2" -o "$VER3" = "3.19.3" -o "$VER3" = "3.22.0" \
&& patch sqlite3/sqlite3.c <<'EOD'
--- sqlite3.c.orig 2015-09-18 17:17:58.000000000 +0200
+++ sqlite3.c 2015-09-18 17:50:01.000000000 +0200
@@ -128353,7 +128353,7 @@
#if defined(_WIN32) || defined(WIN32)
# include <io.h>
-/* # include <fcntl.h> */
+# include <fcntl.h>
# define isatty(h) _isatty(h)
# ifndef access
# define access(f,m) _access((f),(m))
EOD
test "$VER3" = "3.32.2" -o "$VER3" = "3.32.3" \
&& patch sqlite3/sqlite3.c <<'EOD'
--- sqlite3.c.orig 2020-06-12 06:16:37.000000000 +0200
+++ sqlite3.c 2020-06-12 07:34:44.000000000 +0200
@@ -158596,7 +158596,7 @@
# define SQLITE_OMIT_POPEN 1
# else
# include <io.h>
-/* # include <fcntl.h> */
+# include <fcntl.h>
# define isatty(h) _isatty(h)
# ifndef access
# define access(f,m) _access((f),(m))
EOD
# rtree using internal core func
test "$VER3" = "3.32.2" -o "$VER3" = "3.32.3" -o "$VER3" = "3.42.0" \
-o "$VER3" = "3.43.0" -o "$VER3" = "3.43.2" \
&& patch sqlite3/ext/rtree/rtree.c <<'EOD'
--- rtree.c.orig 2020-06-04 16:01:10.000000000 +0200
+++ rtree.c 2020-06-12 11:51:49.000000000 +0200
@@ -62,7 +62,6 @@
#else
#include "sqlite3.h"
#endif
-int sqlite3GetToken(const unsigned char*,int*); /* In the SQLite core */
#ifndef SQLITE_AMALGAMATION
#include "sqlite3rtree.h"
@@ -3667,8 +3666,7 @@
** Return the length of a token
*/
static int rtreeTokenLength(const char *z){
- int dummy = 0;
- return sqlite3GetToken((const unsigned char*)z,&dummy);
+ return strlen(z);
}
/*
EOD
if test -n "$SQLITE_DLLS" ; then
make -C sqlite3 -f ../mf-sqlite3.mingw-cross sqlite3.dll
fi
echo "==================="
echo "Building TinyCC ..."
echo "==================="
( $notcc && echo '*** skipped (NO_TCCEXT)' ) || true
$notcc || ( cd tcc ; sh mingw-cross-build.sh )
# copy SQLite headers into TCC install include directory
$notcc || $nov2 || cp -p sqlite/sqlite.h TCC/include
$notcc || cp -p sqlite3/sqlite3.h sqlite3/src/sqlite3ext.h TCC/include
# copy LGPL to TCC install doc directory
$notcc || cp -p tcc-${TCCVER}/COPYING TCC/doc
$notcc || cp -p tcc-${TCCVER}/README TCC/doc/readme.txt
echo "==============================="
echo "Building ODBC drivers and utils"
echo "==============================="
if $nov2 ; then
make -f Makefile.mingw-cross all_no2
else
make -f Makefile.mingw-cross
fi
make -f Makefile.mingw-cross sqlite3odbc${SEEEXT}nw.dll
echo "=========================="
echo "Building SQLite 2 ... UTF8"
echo "=========================="
( $nov2 && echo '*** skipped (NO_SQLITE2)' ) || true
$nov2 || make -C sqlite -f ../mf-sqlite.mingw-cross clean
$nov2 || make -C sqlite -f ../mf-sqlite.mingw-cross ENCODING=UTF8 all
if test -n "$SQLITE_DLLS" ; then
$nov2 || \
make -C sqlite -f ../mf-sqlite.mingw-cross ENCODING=UTF8 sqliteu.dll
fi
echo "========================="
echo "Building drivers ... UTF8"
echo "========================="
( $nov2 && echo '*** skipped (NO_SQLITE2)' ) || true
$nov2 || make -f Makefile.mingw-cross sqliteodbcu.dll sqliteu.exe
echo "==================================="
echo "Building SQLite3 FTS extensions ..."
echo "==================================="
make -C sqlite3 -f ../mf-sqlite3fts.mingw-cross clean all
mv sqlite3/sqlite3_mod_fts*.dll .
echo "====================================="
echo "Building SQLite3 rtree extensions ..."
echo "====================================="
make -C sqlite3 -f ../mf-sqlite3rtree.mingw-cross clean all
mv sqlite3/sqlite3_mod_rtree.dll .
echo "========================================"
echo "Building SQLite3 extension functions ..."
echo "========================================"
make -f mf-sqlite3extfunc.mingw-cross clean all
echo "============================"
echo "Building DLL import defs ..."
echo "============================"
# requires wine: create .def files with tiny_impdef.exe
# for all .dll files which provide SQLite
( $notcc && echo '*** skipped (NO_TCCEXT)' ) || true
$notcc || $nov2 || wine TCC/tiny_impdef.exe \
sqliteodbc.dll -o TCC/lib/sqlite.def
$notcc || $nov2 || wine TCC/tiny_impdef.exe \
sqliteodbcu.dll -o TCC/lib/sqliteu.def
$notcc || wine TCC/tiny_impdef.exe sqlite3odbc.dll -o TCC/lib/sqlite3.def
if test -n "$SQLITE_DLLS" ; then
$nov2 || mv sqlite/sqlite.dll .
$nov2 || mv sqlite/sqliteu.dll .
mv sqlite3/sqlite3.dll .
fi
if test -n "$SQLITE_DLLS" ; then
$notcc || $nov2 || wine TCC/tiny_impdef.exe \
sqlite.dll -o TCC/lib/sqlite.def
$notcc || $nov2 || wine TCC/tiny_impdef.exe \
sqliteu.dll -o TCC/lib/sqliteu.def
$notcc || wine TCC/tiny_impdef.exe sqlite3.dll -o TCC/lib/sqlite3.def
fi
echo "======================="
echo "Cleanup after build ..."
echo "======================="
$nov2 || make -C sqlite -f ../mf-sqlite.mingw-cross clean
$nov2 || rm -f sqlite/sqlite.exe
mv sqlite3/sqlite3.c sqlite3/sqlite3.amalg
make -C sqlite3 -f ../mf-sqlite3.mingw-cross clean
rm -f sqlite3/sqlite3.exe
make -C sqlite3 -f ../mf-sqlite3fts.mingw-cross clean
make -C sqlite3 -f ../mf-sqlite3rtree.mingw-cross clean
mv sqlite3/sqlite3.amalg sqlite3/sqlite3.c
make -f mf-sqlite3extfunc.mingw-cross semiclean
echo "==========================="
echo "Creating NSIS installer ..."
echo "==========================="
cp -p README readme.txt
unix2dos < license.terms > license.txt || todos < license.terms > license.txt
$notcc || unix2dos -k TCC/doc/COPYING || unix2dos -p TCC/doc/COPYING || \
todos -p TCC/doc/COPYING
$notcc || unix2dos -k TCC/doc/readme.txt || unix2dos -p TCC/doc/readme.txt || \
todos -p TCC/doc/readme.txt
makensis $ADD_NSIS sqliteodbc.nsi
|