Skip to content

Commit

Permalink
Merge remote-tracking branch 'xerial/master' into sync-3.46.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Willena committed Aug 15, 2024
2 parents a3be2cb + 17dffe9 commit 4471595
Show file tree
Hide file tree
Showing 12 changed files with 411 additions and 63 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ jobs:
- arch: ppc64le
distro: ubuntu_latest
java: 21
# RISC-V 64
- arch: riscv64
distro: ubuntu_latest
java: 21
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -220,7 +224,7 @@ jobs:
# echo "PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" | tee -a $GITHUB_ENV
# - name: Cancel action for non SNAPSHOT push
# if: github.event_name == 'push' && !endsWith(env.PROJECT_VERSION, '-SNAPSHOT')
# uses: andymckay/cancel-action@0.4
# uses: andymckay/cancel-action@0.5
# # from that point, if inputs.perform_release is true we perform a release, else we deploy snapshot
# - name: Prepare release
# if: inputs.perform_release
Expand Down Expand Up @@ -264,4 +268,4 @@ jobs:
# uses: EndBug/add-and-commit@v9
# with:
# message: 'chore(release): prepare next snapshot [skip ci]'
# default_author: github_actions
# default_author: github_actions
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ NATIVE_TARGET_DIR:=$(TARGET)/classes/org/sqlite/native/$(OS_NAME)/$(OS_ARCH)
NATIVE_DLL:=$(NATIVE_DIR)/$(LIBNAME)

# For cross-compilation, install docker. See also https://github.com/dockcross/dockcross
native-all: native win32 win64 win-armv7 win-arm64 mac64-signed mac-arm64-signed linux32 linux64 freebsd32 freebsd64 freebsd-arm64 linux-arm linux-armv6 linux-armv7 linux-arm64 linux-android-arm linux-android-arm64 linux-android-x86 linux-android-x64 linux-ppc64 linux-musl32 linux-musl64 linux-musl-arm64
native-all: native win32 win64 win-armv7 win-arm64 mac64-signed mac-arm64-signed linux32 linux64 freebsd32 freebsd64 freebsd-arm64 linux-arm linux-armv6 linux-armv7 linux-arm64 linux-android-arm linux-android-arm64 linux-android-x86 linux-android-x64 linux-ppc64 linux-musl32 linux-musl64 linux-musl-arm64 linux-riscv64

native: $(NATIVE_DLL)

Expand Down Expand Up @@ -226,6 +226,9 @@ linux-android-x64: $(SQLITE_UNPACKED) jni-header
linux-ppc64: $(SQLITE_UNPACKED) jni-header
./docker/dockcross-ppc64 -a $(DOCKER_RUN_OPTS) bash -c 'make clean-native native CROSS_PREFIX=powerpc64le-unknown-linux-gnu- OS_NAME=Linux OS_ARCH=ppc64'

linux-riscv64: $(SQLITE_UNPACKED) jni-header
./docker/dockcross-riscv64 -a $(DOCKER_RUN_OPTS) bash -c 'make clean-native native CROSS_PREFIX=riscv64-unknown-linux-gnu- OS_NAME=Linux OS_ARCH=riscv64'

mac64: $(SQLITE_UNPACKED) jni-header
docker run $(DOCKER_RUN_OPTS) -u "$(BUILDER_UID):$(BUILDER_GID)" -v $$PWD:/workdir -e CROSS_TRIPLE=x86_64-apple-darwin multiarch/crossbuild make clean-native native OS_NAME=Mac OS_ARCH=x86_64

Expand Down
9 changes: 8 additions & 1 deletion Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ endif

# os=Default is meant to be generic unix/linux

known_targets := Linux-x86 Linux-x86_64 Linux-Musl-x86 Linux-Musl-x86_64 Linux-Musl-aarch64 Linux-arm Linux-armv6 Linux-armv7 Linux-aarch64 Linux-Android-arm Linux-Android-aarch64 Linux-Android-x86 Linux-Android-x86_64 Linux-ppc64 Mac-x86 Mac-x86_64 Mac-aarch64 DragonFly-x86_64 FreeBSD-x86 FreeBSD-x86_64 FreeBSD-aarch64 OpenBSD-x86_64 Windows-x86 Windows-x86_64 Windows-armv7 Windows-aarch64 SunOS-sparcv9 HPUX-ia64_32
known_targets := Linux-x86 Linux-x86_64 Linux-Musl-x86 Linux-Musl-x86_64 Linux-Musl-aarch64 Linux-arm Linux-armv6 Linux-armv7 Linux-aarch64 Linux-Android-arm Linux-Android-aarch64 Linux-Android-x86 Linux-Android-x86_64 Linux-ppc64 Linux-riscv64 Mac-x86 Mac-x86_64 Mac-aarch64 DragonFly-x86_64 FreeBSD-x86 FreeBSD-x86_64 FreeBSD-aarch64 OpenBSD-x86_64 Windows-x86 Windows-x86_64 Windows-armv7 Windows-aarch64 SunOS-sparcv9 HPUX-ia64_32
target := $(OS_NAME)-$(OS_ARCH)

ifeq (,$(findstring $(strip $(target)),$(known_targets)))
Expand Down Expand Up @@ -174,6 +174,13 @@ Linux-ppc64_LINKFLAGS := $(Default_LINKFLAGS)
Linux-ppc64_LIBNAME := libsqlitejdbc.so
Linux-ppc64_SQLITE_FLAGS :=

Linux-riscv64_CC := $(CROSS_PREFIX)gcc
Linux-riscv64_STRIP := $(CROSS_PREFIX)strip
Linux-riscv64_CCFLAGS := -I$(JAVA_HOME)/include -Ilib/inc_linux -Os -fPIC -fvisibility=hidden
Linux-riscv64_LINKFLAGS := $(Default_LINKFLAGS)
Linux-riscv64_LIBNAME := libsqlitejdbc.so
Linux-riscv64_SQLITE_FLAGS :=

DragonFly-x86_64_CC := $(CROSS_PREFIX)cc
DragonFly-x86_64_STRIP := $(CROSS_PREFIX)strip
DragonFly-x86_64_CCFLAGS := -I$(JAVA_HOME)/include -Ilib/inc_linux -O2 -fPIC -fvisibility=hidden
Expand Down
18 changes: 9 additions & 9 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
= SQLite JDBC Driver
:project-version: 3.46.0.0
:project-version: 3.46.0.1

image:https://img.shields.io/github/actions/workflow/status/willena/sqlite-jdbc-crypt/ci.yml?branch=master[GitHub Workflow Status (branch),link=https://github.com/willena/sqlite-jdbc/actions/workflows/ci.yml?query=branch%3Amaster]
image:https://maven-badges.herokuapp.com/maven-central/io.github.willena/sqlite-jdbc/badge.svg[Maven Central,link=https://maven-badges.herokuapp.com/maven-central/io.github.willena/sqlite-jdbc/]
Expand Down Expand Up @@ -110,14 +110,14 @@ Since sqlite-jdbc-3.6.19, the natively compiled SQLite engines will be used for
the following operating systems:

|===
| |x86 |x86_64 |armv5 |armv6 |armv7 |arm64 |ppc64

|Windows |✔ |✔ | | |✔ |✔ |
|macOS | |✔ | | | |✔ |
|Linux (libc) |✔ |✔ |✔ |✔ |✔ |✔ |✔
|Linux (musl) |✔ |✔ | | | |✔ |
|Android |✔ |✔ |✔ | | |✔ |
|FreeBSD |✔ |✔ | | | |✔ |
| |x86 |x86_64 |armv5 |armv6 |armv7 |arm64 |ppc64 | riscv64

|Windows |✔ |✔ | | |✔ |✔ | |
|macOS | |✔ | | | |✔ | |
|Linux (libc) |✔ |✔ |✔ |✔ |✔ |✔ |✔ |✔
|Linux (musl) |✔ |✔ | | | |✔ | |
|Android |✔ |✔ |✔ | | |✔ | |
|FreeBSD |✔ |✔ | | | |✔ | |
|===

In the other OSs not listed above, the pure-java SQLite is used. (Applies to versions before 3.7.15)
Expand Down
6 changes: 3 additions & 3 deletions USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ Opening a UNIX (Linux, maxOS, etc.) file `/home/leo/work/mydatabase.db`
try (Connection connection = DriverManager.getConnection("jdbc:sqlite:/home/leo/work/mydatabase.db")) { /*...*/ }
```

## How to Use Memory Databases
SQLite supports on-memory database management, which does not create any database files. To use a memory database in your Java code, get the database connection as follows:
## How to Use Memory or Temporary Databases
SQLite supports in-memory databases, which do not create any database files. To use a memory database in your Java code, get the database connection as follows:

```java
try (Connection connection = DriverManager.getConnection("jdbc:sqlite::memory:")) { /*...*/ }
```

And also, you can create memory database as follows:
You can create temporary database as follows:
```java
try (Connection connection = DriverManager.getConnection("jdbc:sqlite:")) { /*...*/ }
```
Expand Down
278 changes: 278 additions & 0 deletions docker/dockcross-riscv64
Original file line number Diff line number Diff line change
@@ -0,0 +1,278 @@
#!/usr/bin/env bash

DEFAULT_DOCKCROSS_IMAGE=dockcross/linux-riscv64:latest

#------------------------------------------------------------------------------
# Helpers
#
err() {
echo -e >&2 "ERROR: $*\n"
}

die() {
err "$*"
exit 1
}

has() {
# eg. has command update
local kind=$1
local name=$2

type -t $kind:$name | grep -q function
}

# If OCI_EXE is not already set, search for a container executor (OCI stands for "Open Container Initiative")
if [ -z "$OCI_EXE" ]; then
if which podman >/dev/null 2>/dev/null; then
OCI_EXE=podman
elif which docker >/dev/null 2>/dev/null; then
OCI_EXE=docker
else
die "Cannot find a container executor. Search for docker and podman."
fi
fi

#------------------------------------------------------------------------------
# Command handlers
#
command:update-image() {
$OCI_EXE pull $FINAL_IMAGE
}

help:update-image() {
echo "Pull the latest $FINAL_IMAGE ."
}

command:update-script() {
if cmp -s <( $OCI_EXE run --rm $FINAL_IMAGE ) $0; then
echo "$0 is up to date"
else
echo -n "Updating $0 ... "
$OCI_EXE run --rm $FINAL_IMAGE > $0 && echo ok
fi
}

help:update-script() {
echo "Update $0 from $FINAL_IMAGE ."
}

command:update() {
command:update-image
command:update-script
}

help:update() {
echo "Pull the latest $FINAL_IMAGE, and then update $0 from that."
}

command:help() {
if [[ $# != 0 ]]; then
if ! has command $1; then
err \"$1\" is not an dockcross command
command:help
elif ! has help $1; then
err No help found for \"$1\"
else
help:$1
fi
else
cat >&2 <<ENDHELP
Usage: dockcross [options] [--] command [args]
By default, run the given *command* in an dockcross Docker container.
The *options* can be one of:
--args|-a Extra args to the *docker run* command
--image|-i Docker cross-compiler image to use
--config|-c Bash script to source before running this script
Additionally, there are special update commands:
update-image
update-script
update
For update command help use: $0 help <command>
ENDHELP
exit 1
fi
}

#------------------------------------------------------------------------------
# Option processing
#
special_update_command=''
while [[ $# != 0 ]]; do
case $1 in

--)
shift
break
;;

--args|-a)
ARG_ARGS="$2"
shift 2
;;

--config|-c)
ARG_CONFIG="$2"
shift 2
;;

--image|-i)
ARG_IMAGE="$2"
shift 2
;;
update|update-image|update-script)
special_update_command=$1
break
;;
-*)
err Unknown option \"$1\"
command:help
exit
;;

*)
break
;;

esac
done

# The precedence for options is:
# 1. command-line arguments
# 2. environment variables
# 3. defaults

# Source the config file if it exists
DEFAULT_DOCKCROSS_CONFIG=~/.dockcross
FINAL_CONFIG=${ARG_CONFIG-${DOCKCROSS_CONFIG-$DEFAULT_DOCKCROSS_CONFIG}}

[[ -f "$FINAL_CONFIG" ]] && source "$FINAL_CONFIG"

# Set the docker image
FINAL_IMAGE=${ARG_IMAGE-${DOCKCROSS_IMAGE-$DEFAULT_DOCKCROSS_IMAGE}}

# Handle special update command
if [ "$special_update_command" != "" ]; then
case $special_update_command in

update)
command:update
exit $?
;;

update-image)
command:update-image
exit $?
;;

update-script)
command:update-script
exit $?
;;

esac
fi

# Set the docker run extra args (if any)
FINAL_ARGS=${ARG_ARGS-${DOCKCROSS_ARGS}}

# Bash on Ubuntu on Windows
UBUNTU_ON_WINDOWS=$([ -e /proc/version ] && grep -l Microsoft /proc/version || echo "")
# MSYS, Git Bash, etc.
MSYS=$([ -e /proc/version ] && grep -l MINGW /proc/version || echo "")
# CYGWIN
CYGWIN=$([ -e /proc/version ] && grep -l CYGWIN /proc/version || echo "")

if [ -z "$UBUNTU_ON_WINDOWS" -a -z "$MSYS" -a "$OCI_EXE" != "podman" ]; then
USER_IDS=(-e BUILDER_UID="$( id -u )" -e BUILDER_GID="$( id -g )" -e BUILDER_USER="$( id -un )" -e BUILDER_GROUP="$( id -gn )")
fi

# Change the PWD when working in Docker on Windows
if [ -n "$UBUNTU_ON_WINDOWS" ]; then
WSL_ROOT="/mnt/"
CFG_FILE=/etc/wsl.conf
if [ -f "$CFG_FILE" ]; then
CFG_CONTENT=$(cat $CFG_FILE | sed -r '/[^=]+=[^=]+/!d' | sed -r 's/\s+=\s/=/g')
eval "$CFG_CONTENT"
if [ -n "$root" ]; then
WSL_ROOT=$root
fi
fi
HOST_PWD=`pwd -P`
HOST_PWD=${HOST_PWD/$WSL_ROOT//}
elif [ -n "$MSYS" ]; then
HOST_PWD=$PWD
HOST_PWD=${HOST_PWD/\//}
HOST_PWD=${HOST_PWD/\//:\/}
elif [ -n "$CYGWIN" ]; then
for f in pwd readlink cygpath ; do
test -n "$(type "${f}" )" || { echo >&2 "Missing functionality (${f}) (in cygwin)." ; exit 1 ; } ;
done ;
HOST_PWD="$( cygpath -w "$( readlink -f "$( pwd ;)" ; )" ; )" ;
else
HOST_PWD=$PWD
[ -L $HOST_PWD ] && HOST_PWD=$(readlink $HOST_PWD)
fi

# Mount Additional Volumes
if [ -z "$SSH_DIR" ]; then
SSH_DIR="$HOME/.ssh"
fi

HOST_VOLUMES=
if [ -e "$SSH_DIR" -a -z "$MSYS" ]; then
if test -n "${CYGWIN}" ; then
HOST_VOLUMES+="-v $(cygpath -w ${SSH_DIR} ; ):/home/$(id -un)/.ssh" ;
else
HOST_VOLUMES+="-v $SSH_DIR:/home/$(id -un)/.ssh" ;
fi ;
fi

#------------------------------------------------------------------------------
# Now, finally, run the command in a container
#
TTY_ARGS=
tty -s && [ -z "$MSYS" ] && TTY_ARGS=-ti
CONTAINER_NAME=dockcross_$RANDOM
$OCI_EXE run $TTY_ARGS --name $CONTAINER_NAME \
-v "$HOST_PWD":/work \
$HOST_VOLUMES \
"${USER_IDS[@]}" \
$FINAL_ARGS \
$FINAL_IMAGE "$@"
run_exit_code=$?

# Attempt to delete container
rm_output=$($OCI_EXE rm -f $CONTAINER_NAME 2>&1)
rm_exit_code=$?
if [[ $rm_exit_code != 0 ]]; then
if [[ "$CIRCLECI" == "true" ]] && [[ $rm_output == *"Driver btrfs failed to remove"* ]]; then
: # Ignore error because of https://circleci.com/docs/docker-btrfs-error/
else
echo "$rm_output"
exit $rm_exit_code
fi
fi

exit $run_exit_code

################################################################################
#
# This image is not intended to be run manually.
#
# To create a dockcross helper script for the
# dockcross/linux-riscv64:latest image, run:
#
# docker run --rm dockcross/linux-riscv64:latest > dockcross-linux-riscv64-latest
# chmod +x dockcross-linux-riscv64-latest
#
# You may then wish to move the dockcross script to your PATH.
#
################################################################################
Loading

0 comments on commit 4471595

Please sign in to comment.