+berkeley-db

This commit is contained in:
Max Howell 2022-12-20 11:13:28 -05:00
parent 46c5117b92
commit 6dfec14f5a
2 changed files with 71 additions and 0 deletions

View file

@ -0,0 +1,16 @@
#include <assert.h>
#include <string.h>
#include <db_cxx.h>
int main() {
Db db(NULL, 0);
assert(db.open(NULL, "test.db", NULL, DB_BTREE, DB_CREATE, 0) == 0);
const char *project = "Homebrew";
const char *stored_description = "The missing package manager for macOS";
Dbt key(const_cast<char *>(project), strlen(project) + 1);
Dbt stored_data(const_cast<char *>(stored_description), strlen(stored_description) + 1);
assert(db.put(NULL, &key, &stored_data, DB_NOOVERWRITE) == 0);
Dbt returned_data;
assert(db.get(NULL, &key, &returned_data, 0) == 0);
assert(strcmp(stored_description, (const char *)(returned_data.get_data())) == 0);
assert(db.close(0) == 0);
}

View file

@ -0,0 +1,55 @@
distributable:
url: https://download.oracle.com/berkeley-db/db-{{version}}.tar.gz
strip-components: 1
versions:
- 18.1.40
dependencies:
openssl.org: ^1.1.1
build:
dependencies:
tea.xyz/gx/cc: c99
tea.xyz/gx/make: '*'
working-directory: build_unix
script: |
../dist/configure $ARGS
make install DOCLIST=license
rm -rf "{{prefix}}/docs"
env:
ARGS:
- --disable-debug
- --disable-static
- --prefix={{prefix}}
- --enable-cxx
- --enable-compat185
- --enable-sql
- --enable-sql_codegen
- --enable-dbm
- --enable-stl
test:
dependencies:
tea.xyz/gx/cc: c99
script: |
c++ fixture.cpp -ldb_cxx
./a.out
test -f test.db
provides:
- bin/db_verify
- bin/db_upgrade
- bin/db_tuner
- bin/db_replicate
- bin/db_stat
- bin/db_recover
- bin/db_load
- bin/db_log_verify
- bin/db_printlog
- bin/db_dump
- bin/db_hotbackup
- bin/db_deadlock
- bin/db_checkpoint
- bin/db_convert
- bin/db_archive