Skip to content

Commit 58c48d3

Browse files
committed
Fix the debut PKGBUILD
1 parent c086e70 commit 58c48d3

File tree

2 files changed

+81
-8
lines changed

2 files changed

+81
-8
lines changed

README.md

Lines changed: 75 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,75 @@
1-
# bux-sqlite
2-
Wrapper classes and utilities of the original sqlite3 CAPI
1+
2+
## Table of Contents
3+
4+
* [Rationale](#rationale)
5+
* [API Summary](#api-summary)
6+
* [Recurring Types and Their Safe Counterparts](#recurring-types-and-their-safe-counterparts)
7+
* [Installation](#installation)
8+
* [in <a href="https://archlinux.org/" rel="nofollow">ArchLinux</a>](#in-archlinux)
9+
* [from github in any of <a href="https://distrowatch.com/" rel="nofollow">Linux distros</a>](#from-github-in-any-of-linux-distros)
10+
11+
*(Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc))*
12+
13+
## Rationale
14+
15+
The idea is to minimize boilerplate code when doing the same things using native [SQLite API](https://www.sqlite.org/capi3ref.html). Only recurring usages are wrapped into helper classes or plain functions. Mixed uses of this module and the native API are expected. Always prefer `bux::C_SQLite`, `bux::C_SQLiteStmt` over `sqlite3*`, `sqlite3_stmt*` and you will be fine.
16+
17+
## API Summary
18+
19+
### Recurring Types and Their Safe Counterparts
20+
21+
| Original Type | Wrapper Class |
22+
|:-------------:|:--------------|
23+
| `sqlite3*` | `bux::C_SQLite` |
24+
| `sqlite3_stmt*` | `bux::C_SQLiteStmt` |
25+
26+
1. The right colum (_class type_) of each row above can be cast to the left column (_native SQLite pointer type_) implicitly & _safely_.
27+
2. `bux::C_SQLite` can only be constructed by a valid SQLite databse file name.
28+
3. `bux::C_SQLiteStmt` is contructed by passing a `bux::C_SQLite` instance and a SQL statement. And it is the recommended way to bind SQL arguments by calling native `sqlite3_bind_\w+()` functions before its own `execute()` method.
29+
30+
## Installation
31+
32+
### in [ArchLinux](https://archlinux.org/)
33+
34+
1. Make sure you have installed [`yay`](https://aur.archlinux.org/packages/yay/) or any other [pacman wrapper](https://wiki.archlinux.org/index.php/AUR_helpers).
35+
2. `yay -S bux-sqlite` to install. `bux` is also installed with it.
36+
3. `yay -Ql bux-sqlite` to see the installed files:
37+
38+
~~~bash
39+
bux-mariadb-client /usr/
40+
bux-mariadb-client /usr/include/
41+
bux-mariadb-client /usr/include/bux/
42+
bux-mariadb-client /usr/include/bux/oo_mariadb.h
43+
bux-mariadb-client /usr/lib/
44+
bux-mariadb-client /usr/lib/libbux-mariadb-client.a
45+
bux-mariadb-client /usr/share/
46+
bux-mariadb-client /usr/share/licenses/
47+
bux-mariadb-client /usr/share/licenses/bux-mariadb-client/
48+
bux-mariadb-client /usr/share/licenses/bux-mariadb-client/LICENSE
49+
~~~
50+
51+
4. Include the sole header file by prefixing the header name with `bux/`:
52+
53+
~~~c++
54+
#include <bux/oo_sqlite.h>
55+
~~~
56+
57+
*p.s.* Compiler is expected to search `/usr/include` by default.
58+
5. If directly using `gcc` or `clang` is intended, the required compiler flags are `-lbux-sqlite -lbux`
59+
60+
### from github in any of [Linux distros](https://distrowatch.com/)
61+
62+
1. Make sure you have installed `cmake` `make` `gcc` `git` `fmt` `sqlite`, or the likes. Known package names in different distros/package-managers:
63+
| Distro/PkgMngr | Package Name |
64+
|:----------------:|:------------:|
65+
| ArchLinux/yay | `fmt`, `sqlite` |
66+
| Fedora/dnf | `fmt-devel`, `sqlite-devel` |
67+
68+
2. ~~~bash
69+
git clone https://github.com/buck-yeh/bux-sqlite.git
70+
cd bux-sqlite
71+
cmake -D FETCH_DEPENDEES=1 -D DEPENDEE_ROOT=_deps .
72+
make -j
73+
~~~
74+
75+
3. Include `include/bux/oo_sqlite.h` and link with `src/libbux-sqlite.a`

distros/archlinux/PKGBUILD

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
# then please put 'unknown'.
55

66
# Maintainer: Buck Yeh <buck.yeh at gmail dot com>
7-
pkgname=bux-mariadb-client
7+
pkgname=bux-sqlite
88
pkgver=VERSION
99
pkgrel=1
1010
epoch=
11-
pkgdesc='Wrapper classes and utilities of the original sqlite3 CAPI'
11+
pkgdesc='Wrapper classes and utilities of the original SQLite3 CAPI'
1212
arch=('x86_64')
1313
url='https://github.com/buck-yeh/bux-sqlite.git'
1414
license=('MIT')
1515
groups=()
16-
depends=('sqlite' 'bux' 'fmt')
16+
depends=('sqlite' 'fmt')
1717
makedepends=('cmake' 'make' 'gcc' 'git' 'binutils' 'fakeroot' 'gawk')
1818
checkdepends=()
1919
optdepends=()
@@ -45,10 +45,10 @@ build() {
4545

4646
check() {
4747
cd "$pkgname" || return 1
48-
if [[ ! -f src/libbux-mariadb-client.a ]]; then
48+
if [[ ! -f src/libbux-sqlite.a ]]; then
4949
return 1
5050
fi
51-
if [[ ! -f include/bux/oo_mariadb.h ]]; then
51+
if [[ ! -f include/bux/oo_sqlite.h ]]; then
5252
return 1
5353
fi
5454
return 0
@@ -58,7 +58,7 @@ package() {
5858
cd "$pkgname" || return 1
5959
mkdir -p "$pkgdir/usr/lib"
6060
mkdir -p "$pkgdir/usr/include/bux"
61-
cp src/libbux-mariadb-client.a "$pkgdir/usr/lib/"
61+
cp src/libbux-sqlite.a "$pkgdir/usr/lib/"
6262
cp include/bux/*.h "$pkgdir/usr/include/bux/"
6363
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
6464
}

0 commit comments

Comments
 (0)