Skip to content

Commit

Permalink
v0.4.0-alpha.2: (update for issue #31) Added desktop (Electron) launc…
Browse files Browse the repository at this point in the history
…her for CypherPoker.JS that retains existing "web" and "server" structures and uses a SQLite 3 database for local storage; tested on Windows 10 and all functionality appears to work as expected (compared to existing web version); note that a "postinstall.js" script applies a patch to bitcoinjs-lib and BIP32 modules for compatibility with >= Electron 4.x.x (since switch to BoringSSL -- electron/electron#16454).
  • Loading branch information
monicanagent committed Feb 18, 2019
1 parent 5922e97 commit a3a68f2
Show file tree
Hide file tree
Showing 26 changed files with 1,266 additions and 0 deletions.
678 changes: 678 additions & 0 deletions src/desktop/adapters/sqlite3.js

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions src/desktop/bin/sqlite/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
SQLite is in the Public Domain

All of the code and documentation in SQLite has been dedicated to the public domain by the authors. All code authors, and representatives of the companies they work for, have signed affidavits dedicating their contributions to the public domain and originals of those signed affidavits are stored in a firesafe at the main offices of Hwaci. Anyone is free to copy, modify, publish, use, compile, sell, or distribute the original SQLite code, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

The previous paragraph applies to the deliverable code and documentation in SQLite - those parts of the SQLite library that you actually bundle and ship with a larger application. Some scripts used as part of the build process (for example the "configure" scripts generated by autoconf) might fall under other open-source licenses. Nothing from these build scripts ever reaches the final deliverable SQLite library, however, and so the licenses associated with those scripts should not be a factor in assessing your rights to copy and use the SQLite library.

All of the deliverable code in SQLite has been written from scratch. No code has been taken from other projects or from the open internet. Every line of code can be traced back to its original author, and all of those authors have public domain dedications on file. So the SQLite code base is clean and is uncontaminated with licensed code from other projects.

Open-Source, not Open-Contribution

SQLite is open-source, meaning that you can make as many copies of it as you want and do whatever you want with those copies, without limitation. But SQLite is not open-contribution. In order to keep SQLite in the public domain and ensure that the code does not become contaminated with proprietary or licensed content, the project does not accept patches from unknown persons.

All of the code in SQLite is original, having been written specifically for use by SQLite. No code has been copied from unknown sources on the internet.

Warranty of Title

SQLite is in the public domain and does not require a license. Even so, some organizations want legal proof of their right to use SQLite. Circumstances where this occurs include the following:

- Your company desires indemnity against claims of copyright infringement.
- You are using SQLite in a jurisdiction that does not recognize the public domain.
- You are using SQLite in a jurisdiction that does not recognize the right of an author to dedicate their work to the public domain.
- You want to hold a tangible legal document as evidence that you have the legal right to use and distribute SQLite.
- Your legal department tells you that you have to purchase a license.

If any of the above circumstances apply to you, Hwaci, the company that employs all the developers of SQLite, will sell you a Warranty of Title for SQLite. A Warranty of Title is a legal document that asserts that the claimed authors of SQLite are the true authors, and that the authors have the legal right to dedicate the SQLite to the public domain, and that Hwaci will vigorously defend against challenges to those claims. All proceeds from the sale of SQLite Warranties of Title are used to fund continuing improvement and support of SQLite.

Contributed Code

In order to keep SQLite completely free and unencumbered by copyright, the project does not accept patches. If you would like to make a suggested change, and include a patch as a proof-of-concept, that would be great. However please do not be offended if we rewrite your patch from scratch.
9 changes: 9 additions & 0 deletions src/desktop/bin/sqlite/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## SQLite Executable binaries

The sub-directories in this directory contain the native SQLite executable binaries for all supported operating systems.

All binaries were downloaded from the official SQLite site (https://sqlite.org/download.html), except for the 64-bit Linux executables found in the <code>linux64</code> folder which were downloaded from Bora M. Alper's build repository (https://github.com/boramalper/sqlite3-x64/releases).

Required files for building the 64-bit Linux executables are included in the <code>linux64/build</code> directory which is a copy of the repository <code>trunk</code> (https://github.com/boramalper/sqlite3-x64). Refer to the <code>linux64/build/README.md</code> file for instructions on building these binaries from source code.

Currently only Windows 32-bit binaries (<code>win32</code>) are available for both 32 and 64-bit architectures.
Binary file added src/desktop/bin/sqlite/linux32/sqldiff
Binary file not shown.
Binary file added src/desktop/bin/sqlite/linux32/sqlite3
Binary file not shown.
Binary file added src/desktop/bin/sqlite/linux32/sqlite3_analyzer
Binary file not shown.
3 changes: 3 additions & 0 deletions src/desktop/bin/sqlite/linux64/CHECKSUMS.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
7d9292d97ee6a2519cc803bab1cea759d9c136b8 sqldiff
90b1a0fc9b689f20010269b1473f29da83ff0833 sqlite3
43d3a9180b410cfeb4ed7c407280a41a5c17c3f0 sqlite3_analyzer
1 change: 1 addition & 0 deletions src/desktop/bin/sqlite/linux64/NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
These are UNOFFICIAL SQLite precompiled binaries for linux x64, see https://github.com/boramalper/sqlite3-x64 for details.
135 changes: 135 additions & 0 deletions src/desktop/bin/sqlite/linux64/build/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# sudo: false is faster as it is containerised instead of virtualised.
# https://docs.travis-ci.com/user/reference/overview/#virtualisation-environment-vs-operating-system
sudo: false
dist: xenial

language: c
compiler: gcc

# $ ./configure --help
#
# Some influential environment variables:
# CC C compiler command
# CFLAGS C compiler flags
# LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
# nonstandard directory <lib dir>
# LIBS libraries to pass to the linker, e.g. -l<library>
# CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
# you have headers in a nonstandard directory <include dir>
# CPP C preprocessor
# TCLLIBDIR Where to install tcl plugin
#
# Use these variables to override the choices made by `configure' or to help
# it to find libraries and programs with nonstandard names/locations.
#
# Also: https://docs.travis-ci.com/user/environment-variables/#defining-public-variables-in-travisyml
env:
global:
# https://www.sqlite.org/cli.html#_do_it_yourself_builds_
#
# The following additional compile-time options are recommended in order to
# provide a full-featured command-line shell:
#
# * -DSQLITE_THREADSAFE=0
# * -DSQLITE_ENABLE_EXPLAIN_COMMENTS
# * -DSQLITE_USE_ZLIB
# * -DSQLITE_INTROSPECTION_PRAGMAS
# * -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
# * -DSQLITE_ENABLE_STMTVTAB
# * -DSQLITE_ENABLE_DBPAGE_VTAB
# * -DSQLITE_ENABLE_DBSTAT_VTAB
# * -DSQLITE_ENABLE_OFFSET_SQL_FUNC
# * -DSQLITE_ENABLE_JSON1
# * -DSQLITE_ENABLE_RTREE
# * -DSQLITE_ENABLE_FTS4
# * -DSQLITE_ENABLE_FTS5
#
#
# https://www.sqlite.org/howtocompile.html#compiling_the_command_line_interface
#
# [...] to get command-line editing support:
#
# * -DHAVE_READLINE
# * -lreadline
# * -lncurses
#
# !! We statically link readline (and history) due to readline 6 not being
# !! present on later Ubuntu versions.
# !! See https://utcc.utoronto.ca/~cks/space/blog/linux/Ubuntu1804ReadlineMess
- CFLAGS="-O2 -march=x86-64 -I./ -I/usr/include/tcl -DSQLITE_THREADSAFE=0 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_USE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION -DSQLITE_ENABLE_STMTVTAB -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DHAVE_READLINE"
- LDFLAGS="-march=x86-64"
- LIBS="-ldl -lpthread -lz -lm -ltcl -l:libreadline.a -l:libhistory.a -lncurses -ltermcap"

branches:
only:
- master

install:
- "wget -i sqlite-src.url"
- "sha1sum --check sqlite-src.sha1"
- "unzip sqlite-src-*.zip"
- rm sqlite-src-*.zip
- mv sqlite-src-* sqlite-src

before_script:
- "set -o allexport; source ./env; set +o allexport"
- "cd sqlite-src"

- "./configure"
- "make sqlite3.c"
- "cc -o sqlite3.o -c sqlite3.c ${CFLAGS} ${LDFLAGS} ${LIBS}"

# sqldiff
- "cc -o sqldiff.o -c tool/sqldiff.c ${CFLAGS} ${LDFLAGS} ${LIBS}"
- "cc -o sqldiff sqlite3.o sqldiff.o ${CFLAGS} ${LDFLAGS} ${LIBS}"
- "sha1sum sqldiff | tee CHECKSUMS.sha1"

# sqlite3
- "make shell.c"
- "cc -o shell.o -c shell.c ${CFLAGS} ${LDFLAGS} ${LIBS}"
- "cc -o sqlite3 sqlite3.o shell.o ${CFLAGS} ${LDFLAGS} ${LIBS}"
- "sha1sum sqlite3 | tee -a CHECKSUMS.sha1"

# sqlite3_analyzer
- "make sqlite3_analyzer.c"
- "cc -o sqlite3_analyzer -c sqlite3_analyzer.c ${CFLAGS} ${LDFLAGS} ${LIBS}"
- "sha1sum sqlite3_analyzer | tee -a CHECKSUMS.sha1"

# zip the binaries
- "mkdir sqlite-tools-linux-x64-${S64_VERSION}"
- "echo These are UNOFFICIAL SQLite precompiled binaries for linux x64, see https://github.com/boramalper/sqlite3-x64 for details. > sqlite-tools-linux-x64-${S64_VERSION}/NOTICE"
- "cp sqldiff sqlite3 sqlite3_analyzer CHECKSUMS.sha1 sqlite-tools-linux-x64-${S64_VERSION}/"
- "zip -r sqlite-tools-linux-x64-${S64_VERSION}.zip sqlite-tools-linux-x64-${S64_VERSION}/ -9 -v"
- "sha1sum sqlite-tools-linux-x64-${S64_VERSION}.zip | tee sqlite-tools-linux-x64-${S64_VERSION}.zip.sha1"

script:
- "echo Skipping 'script' stage in Travis CI..."

before_deploy:
# Set up git user name and tag this commit
- git config --local user.name "Bora M. Alper"
- git config --local user.email "bora@boramalper.org"
# $ git help check-ref-format
#
# 2. They must contain at least one /. This enforces the presence of a
# category like heads/, tags/ etc. but the actual names are not restricted.
# If the --allow-onelevel option is used, this rule is waived.
# 4. They cannot have ASCII control characters (i.e. bytes whose values are
# lower than \040, or \177 DEL), space, tilde ~, caret ^, or colon : anywhere.
# 5. They cannot have question-mark ?, asterisk *, or open bracket [ anywhere.
- git tag "${S64_VERSION}--$(date +'%Y-%m-%dT%H.%M.%SZ' --utc)"

deploy:
provider: releases
api_key:
secure: qzaOZ4K7QvEmSoij71PYqgQlxK/AtN9YelFVJwQzqt8Q8cxqqccXtoSciPQHN2nZEVUb2C7qk7bN93vkxL7Id8eN9FpBGx96kqlJqkYZDGJgGKTr+Fq4XuXjZjO2S9qpOJCDXpGOTKJE9qnMV7j08ax1u9OGAw7zeUfRjd1LgIAJEpFLzWGm3GTYy0hLtfrxtD4hodkLaIkA9azgWaKJWwRf0gqc25Ev8PElMGuYov7LtGNmb9V7hpVAqa55vSq32dvVreAoqomfxShmKjwpWP9P2fwxgc/F8XPFcySmxqwGWXfvrxoViQmVqfdW0ZKaBHm1VZkcfc9O6NL90AS2KpNYIn/fgigdPErxqfXP2GFWLVCuHmWVOhU+FoQjq8+sDnvbhOot1zE8NJD/7/HzBYnYK1N1gaf35gXfHHvi5tmnBC2tJ9LMiBk5i51Bgv+hPHLaOo6uYOddVxbOhGOQjek+zs4JmJ3Mqg0ACFC8BvEb8/rrd0qyP4DG+5btpQeDWMGADR9dApdekQnd7UIar9upiQnIQ/UuqKKDsbsx3xQPK1cjfXUbour5PkFe1ckkrGK1S5dDd7ZT2ql/u7GhWZw8W6SOOyTYdeYzW9awqciJQCcg4Sm1xnB4g2KuVxQLHGu1UMzFgb6n7al3i6twwcamVNTvZsjVj7Kbuz6JJnw=
file:
- "/home/travis/build/boramalper/sqlite3-x64/sqlite-src/sqldiff"
- "/home/travis/build/boramalper/sqlite3-x64/sqlite-src/sqlite3"
- "/home/travis/build/boramalper/sqlite3-x64/sqlite-src/sqlite3_analyzer"
- "/home/travis/build/boramalper/sqlite3-x64/sqlite-src/CHECKSUMS.sha1"
- "/home/travis/build/boramalper/sqlite3-x64/sqlite-src/sqlite-tools-linux-x64-${S64_VERSION}.zip"
- "/home/travis/build/boramalper/sqlite3-x64/sqlite-src/sqlite-tools-linux-x64-${S64_VERSION}.zip.sha1"
skip_cleanup: true
on:
repo: "boramalper/sqlite3-x64"
68 changes: 68 additions & 0 deletions src/desktop/bin/sqlite/linux64/build/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# sqlite3-x64
As SQLite doesn't provide 64-bit versions of its precompiled binaries, I have
decided to provide them myself since building those tools (`sqldiff`, `sqlite3`,
and `sqlite3_analyzer`) can be quite time-consuming, and wildly inconvenient
when you are trying to access your database for a quick query...

[**RELEASES**](https://github.com/boramalper/sqlite3-x64/releases)

- **`sqldiff`**
- **`sqlite3`**
- **`sqlite3_analyzer`**
- **`CHECKSUMS.sha1`**

SHA-1 checksums of the binaries `sqldiff`, `sqlite3`, and `sqlite3_analyzer`.
- **`sqlite-tools-linux-x64-<VERSION>.zip`**

ZIP archive of the binaries `sqldiff`, `sqlite3`, and `sqlite3_analyzer`.
- **`sqlite-tools-linux-x64-<VERSION>.zip.sha1`**


## Building Process
1. This repository contains a file called `sqlite-src.url` which contains the
URL to the source code of the latest release of SQLite.

2. Whenever changes are pushed to [the GitHub repository](https://github.com/boramalper/sqlite3-x64),
[Travis CI](https://travis-ci.org/boramalper/sqlite3-x64):
1. Compiles the binaries and zips them
2. Creates a new [release](https://github.com/boramalper/sqlite3-x64/releases)
3. Deploys the binaries

## Security
You might reasonably be concerned about whether the precompiled binaries are
tampered by me or not, for which you can check the `.travis.yml` file, and the
build log on [Travis CI](https://travis-ci.org/boramalper/sqlite3-x64)
which shows how the tools are compiled, and the SHA-1 sums of the SQLite source
zip (`sqlite-src-*.zip`), of the binaries, and of the final zip file
(`sqlite-tools-linux-x64-*.zip`).

## Release Process
To release the precompiled binaries for the newest version of SQLite:

1. Update `sqlite-src.url` with the URL of the source zip (`sqlite-src-*.zip`)

```
https://www.sqlite.org/2018/sqlite-src-3240000.zip
```

2. Update `sqlite-src.sha1` with the SHA1 checksum of the source zip.

**Beware** of the formatting: SHA1 checksum, seperated by two spaces, and the
file name, on a single line

```
fb558c49ee21a837713c4f1e7e413309aabdd9c7 sqlite-src-3240000.zip
```

3. Update `env` with the version number:

```
S64_VERSION=3240000
```

4. Commit changes, and push.

**Beware** of your commit message:

- All release commit messages must be of the format `[release] <VERSION>`.
- For all other changes, commit messages must be prefixed with `[other]`.
1 change: 1 addition & 0 deletions src/desktop/bin/sqlite/linux64/build/env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
S64_VERSION=3260000
1 change: 1 addition & 0 deletions src/desktop/bin/sqlite/linux64/build/sqlite-src.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a05429d6a8337d60ddc7c6381b49941059a55f68 sqlite-src-3260000.zip
1 change: 1 addition & 0 deletions src/desktop/bin/sqlite/linux64/build/sqlite-src.url
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://www.sqlite.org/2018/sqlite-src-3260000.zip
Binary file added src/desktop/bin/sqlite/linux64/sqldiff
Binary file not shown.
Binary file added src/desktop/bin/sqlite/linux64/sqlite3
Binary file not shown.
Binary file added src/desktop/bin/sqlite/linux64/sqlite3_analyzer
Binary file not shown.
Binary file added src/desktop/bin/sqlite/osx/sqldiff
Binary file not shown.
Binary file added src/desktop/bin/sqlite/osx/sqlite3
Binary file not shown.
Binary file added src/desktop/bin/sqlite/osx/sqlite3_analyzer
Binary file not shown.
Binary file added src/desktop/bin/sqlite/win32/sqldiff.exe
Binary file not shown.
Binary file added src/desktop/bin/sqlite/win32/sqlite3.exe
Binary file not shown.
Binary file added src/desktop/bin/sqlite/win32/sqlite3_analyzer.exe
Binary file not shown.
Binary file added src/desktop/db/cypherpoker.js.sqlite3
Binary file not shown.
Loading

0 comments on commit a3a68f2

Please sign in to comment.