Compare commits
4 Commits
master
...
dev/etan/c
Author | SHA1 | Date |
---|---|---|
Etan Kissling | 1898dbbeb9 | |
Etan Kissling | 78b7e45dcd | |
Etan Kissling | 4ab7cbe80a | |
Etan Kissling | 9178cc545a |
|
@ -1,6 +1,5 @@
|
||||||
# Generated @ 2023-02-21T09:43:32+01:00
|
|
||||||
# Command line:
|
# Command line:
|
||||||
# /home/arnetheduck/.nimble/pkgs2/nimterop-0.6.13-a93246b2ad5531db11e51de7b2d188c42d95576a/nimterop/toast --preprocess -m:c -H --compile+=sqlite3_abi/sqlite3.c --pnim --symOverride=sqlite3_index_info,sqlite3_vmprintf,sqlite3_vsnprintf,sqlite3_str_vappendf,sqlite_int64,sqlite_uint64,sqlite3_int64,sqlite3_uint64,SQLITE_STATIC,sqlite3_version --nim:/home/arnetheduck/src/Nim/bin/nim --pluginSourcePath=/home/arnetheduck/.cache/nim/nimterop/cPlugins/nimterop_2309319294.nim /home/arnetheduck/src/nim-sqlite3-abi/sqlite3_abi/sqlite3.h -o /home/arnetheduck/src/nim-sqlite3-abi/sqlite3_abi/sqlite3_gen.nim
|
# ~/.nimble/pkgs2/nimterop-0.6.13-a93246b2ad5531db11e51de7b2d188c42d95576a/nimterop/toast --preprocess -m:c -H --compile+=sqlite3_abi/sqlite3.c --pnim --symOverride=sqlite3_index_info,sqlite3_vmprintf,sqlite3_vsnprintf,sqlite3_str_vappendf,sqlite_int64,sqlite_uint64,sqlite3_int64,sqlite3_uint64,SQLITE_STATIC,sqlite3_version --nim:nim --pluginSourcePath=~/.cache/nim/nimterop/cPlugins/nimterop_2309319294.nim sqlite3_abi/sqlite3.h -o sqlite3_abi/sqlite3_gen.nim
|
||||||
|
|
||||||
# const 'SQLITE_EXTERN' has unsupported value 'extern'
|
# const 'SQLITE_EXTERN' has unsupported value 'extern'
|
||||||
# const 'SQLITE_STDCALL' has unsupported value 'SQLITE_APICALL'
|
# const 'SQLITE_STDCALL' has unsupported value 'SQLITE_APICALL'
|
||||||
|
|
30
update.sh
30
update.sh
|
@ -1,31 +1,43 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
set -eu -o pipefail
|
||||||
|
cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")"
|
||||||
|
|
||||||
|
# https://www.sqlite.org/download.html
|
||||||
MAJOR="${1:-3}"
|
MAJOR="${1:-3}"
|
||||||
MINOR="${2:-40}"
|
MINOR="${2:-40}"
|
||||||
PATCH="${3:-1}"
|
PATCH="${3:-1}"
|
||||||
|
YEAR="${4:-2022}"
|
||||||
|
HASH="${5:-2618a7f311ce3f8307c45035bce31805185d632241b2af6c250b4531f09edccb}"
|
||||||
|
|
||||||
VER_INT="$(printf "%d%02d%02d00" "$MAJOR" "$MINOR" "$PATCH")"
|
VER_INT="$(printf "%d%02d%02d00" "$MAJOR" "$MINOR" "$PATCH")"
|
||||||
|
|
||||||
# TODO check sha256sum
|
|
||||||
cd sqlite3_abi
|
cd sqlite3_abi
|
||||||
|
|
||||||
ZIP="sqlite-amalgamation-$VER_INT.zip"
|
ZIP="sqlite-amalgamation-$VER_INT.zip"
|
||||||
[ -f "$ZIP" ] || wget https://www.sqlite.org/2022/$ZIP
|
[ -f "$ZIP" ] || wget https://www.sqlite.org/$YEAR/$ZIP
|
||||||
|
HASH_ACTUAL=$(python3 -c "import hashlib; print(hashlib.sha3_256(open('$ZIP', 'rb').read()).hexdigest())")
|
||||||
|
if [[ "${HASH_ACTUAL}" != "${HASH}" ]]; then
|
||||||
|
echo "Incorrect ${ZIP} hash: ${HASH}"
|
||||||
|
false
|
||||||
|
fi
|
||||||
|
|
||||||
unzip -jo $ZIP "sqlite-amalgamation-$VER_INT/sqlite3.c" "sqlite-amalgamation-$VER_INT/sqlite3.h"
|
unzip -jo $ZIP "sqlite-amalgamation-$VER_INT/sqlite3.c" "sqlite-amalgamation-$VER_INT/sqlite3.h"
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
[[ -v HAS_NIMTEROP ]] || nimble install -y nimterop@0.6.13
|
(( ${HAS_NIMTEROP:-0} )) || nimble install -y nimterop@0.6.13
|
||||||
|
|
||||||
nim c -o:wrap --verbosity:0 --hints:off ./sqlite3_abi/wrap.nim
|
nim c -o:wrap --skipParentCfg --verbosity:0 --hints:off ./sqlite3_abi/wrap.nim
|
||||||
./wrap
|
./wrap
|
||||||
|
|
||||||
sed -i \
|
sed -i.bak \
|
||||||
-e "s|cdecl|sqlitedecl|g" \
|
-e "s|cdecl|sqlitedecl|g" \
|
||||||
-e "s|$PWD/||" \
|
-e "\|Generated @|d" \
|
||||||
-e 's|{.experimental: "codeReordering".}|{.experimental: "codeReordering".}\nwhen (NimMajor, NimMinor) < (1, 4):\n {.pragma: sqlitedecl, cdecl, gcsafe, raises: [Defect].}\nelse:\n {.pragma: sqlitedecl, gcsafe, cdecl, raises: [].}|' \
|
-e "s|$PWD/||g" \
|
||||||
|
-e "s|$HOME|~|g" \
|
||||||
|
-e "s|--nim:/[^ ]*|--nim:nim|g" \
|
||||||
|
-e 's|{.experimental: "codeReordering".}|{.experimental: "codeReordering".}\nwhen (NimMajor, NimMinor) < (1, 4):\n {.pragma: sqlitedecl, cdecl, gcsafe, raises: [Defect].}\nelse:\n {.pragma: sqlitedecl, cdecl, gcsafe, raises: [].}|' \
|
||||||
-e "s|sqlite3_column_text\\*(a1: ptr sqlite3_stmt; iCol: cint): ptr cuchar|sqlite3_column_text\\*(a1: ptr sqlite3_stmt; iCol: cint): cstring|" \
|
-e "s|sqlite3_column_text\\*(a1: ptr sqlite3_stmt; iCol: cint): ptr cuchar|sqlite3_column_text\\*(a1: ptr sqlite3_stmt; iCol: cint): cstring|" \
|
||||||
-e "s|sqlite3_value_text\\*(a1: ptr sqlite3_value): ptr cuchar|sqlite3_value_text\\*(a1: ptr sqlite3_value): cstring|" \
|
-e "s|sqlite3_value_text\\*(a1: ptr sqlite3_value): ptr cuchar|sqlite3_value_text\\*(a1: ptr sqlite3_value): cstring|" \
|
||||||
sqlite3_abi/sqlite3_gen.nim
|
sqlite3_abi/sqlite3_gen.nim
|
||||||
|
rm -f sqlite3_abi/sqlite3_gen.nim.bak # Portable GNU/macOS `sed` needs backup
|
||||||
|
|
Loading…
Reference in New Issue