From 54df2afaa61c6a03cbb4a33c9b90fa572b6d07b8 Mon Sep 17 00:00:00 2001 From: Jesse Morgan Date: Sat, 17 Dec 2016 21:28:53 -0800 Subject: Berkeley DB 4.8 with rust build script for linux. --- db-4.8.30/build_vxworks/dbdemo/README | 39 ++++++ db-4.8.30/build_vxworks/dbdemo/dbdemo.c | 177 +++++++++++++++++++++++++ db-4.8.30/build_vxworks/dbdemo/dbdemo20.wpj | 158 +++++++++++++++++++++++ db-4.8.30/build_vxworks/dbdemo/dbdemo22.wpj | 192 ++++++++++++++++++++++++++++ 4 files changed, 566 insertions(+) create mode 100644 db-4.8.30/build_vxworks/dbdemo/README create mode 100644 db-4.8.30/build_vxworks/dbdemo/dbdemo.c create mode 100755 db-4.8.30/build_vxworks/dbdemo/dbdemo20.wpj create mode 100755 db-4.8.30/build_vxworks/dbdemo/dbdemo22.wpj (limited to 'db-4.8.30/build_vxworks/dbdemo') diff --git a/db-4.8.30/build_vxworks/dbdemo/README b/db-4.8.30/build_vxworks/dbdemo/README new file mode 100644 index 0000000..1a2c7c7 --- /dev/null +++ b/db-4.8.30/build_vxworks/dbdemo/README @@ -0,0 +1,39 @@ +This README describes the steps needed to run a demo example of BerkeleyDB. + +1. Read the pages in the Reference Guide that describe building + BerkeleyDB on VxWorks: + + $(WIND_BASE)/target/src/BerkeleyDB/docs/ref/build_vxworks/intro.html + $(WIND_BASE)/target/src/BerkeleyDB/docs/ref/build_vxworks/notes.html + $(WIND_BASE)/target/src/BerkeleyDB/docs/ref/build_vxworks/faq.html + +2. Launch Tornado 2.0 and open up the BerkeleyDB project. + +3. Add the demo project to that workspace: + + $(WIND_BASE)/target/src/BerkeleyDB/build_vxworks/demo/dbdemo.wpj + +4. Build BerkeleyDB as described in the Reference Guide. + +5. Build the dbdemo project. + +6. Download BerkeleyDB onto the target. + +7. Download the dbdemo project onto the target. + +8. Open a windsh to the target and run the demo: + + -> dbdemo "/" + + Where pathname is a pathname string pointing to a directory that the + demo can create a database in. That directory should already exist. + The dbname is the name for the database. For example: + + -> dbdemo "/tmp/demo.db" + +9. The demo program will ask for input. You can type in any string. + The program will add an entry to the database with that string as + the key and the reverse of that string as the data item for that key. + It will continue asking for input until you hit ^D or enter "quit". + Upon doing so, the demo program will display all the keys you have + entered as input and their data items. diff --git a/db-4.8.30/build_vxworks/dbdemo/dbdemo.c b/db-4.8.30/build_vxworks/dbdemo/dbdemo.c new file mode 100644 index 0000000..6a18b41 --- /dev/null +++ b/db-4.8.30/build_vxworks/dbdemo/dbdemo.c @@ -0,0 +1,177 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997-2009 Oracle. All rights reserved. + * + * $Id$ + */ + +#include + +#include +#include +#include + +#ifdef _WIN32 +extern int getopt(int, char * const *, const char *); +#else +#include +#endif + +#include +#include + +#define DATABASE "access.db" +int dbdemo_main __P((int, char *[])); +int dbdemo_usage __P((void)); + +int +dbdemo(args) + char *args; +{ + int argc; + char **argv; + + __db_util_arg("dbdemo", args, &argc, &argv); + return (dbdemo_main(argc, argv) ? EXIT_FAILURE : EXIT_SUCCESS); +} + +#include +#define ERROR_RETURN ERROR + +int +dbdemo_main(argc, argv) + int argc; + char *argv[]; +{ + extern int optind, __db_getopt_reset; + DB *dbp; + DBC *dbcp; + DBT key, data; + size_t len; + int ch, ret, rflag; + char *database, *p, *t, buf[1024], rbuf[1024]; + const char *progname = "dbdemo"; /* Program name. */ + + rflag = 0; + __db_getopt_reset = 1; + while ((ch = getopt(argc, argv, "r")) != EOF) + switch (ch) { + case 'r': + rflag = 1; + break; + case '?': + default: + return (dbdemo_usage()); + } + argc -= optind; + argv += optind; + + /* Accept optional database name. */ + database = *argv == NULL ? DATABASE : argv[0]; + + /* Optionally discard the database. */ + if (rflag) + (void)remove(database); + + /* Create and initialize database object, open the database. */ + if ((ret = db_create(&dbp, NULL, 0)) != 0) { + fprintf(stderr, + "%s: db_create: %s\n", progname, db_strerror(ret)); + return (EXIT_FAILURE); + } + dbp->set_errfile(dbp, stderr); + dbp->set_errpfx(dbp, progname); + if ((ret = dbp->set_pagesize(dbp, 1024)) != 0) { + dbp->err(dbp, ret, "set_pagesize"); + goto err1; + } + if ((ret = dbp->set_cachesize(dbp, 0, 32 * 1024, 0)) != 0) { + dbp->err(dbp, ret, "set_cachesize"); + goto err1; + } + if ((ret = dbp->open(dbp, + NULL, database, NULL, DB_BTREE, DB_CREATE, 0664)) != 0) { + dbp->err(dbp, ret, "%s: open", database); + goto err1; + } + + /* + * Insert records into the database, where the key is the user + * input and the data is the user input in reverse order. + */ + memset(&key, 0, sizeof(DBT)); + memset(&data, 0, sizeof(DBT)); + for (;;) { + printf("input> "); + fflush(stdout); + if (fgets(buf, sizeof(buf), stdin) == NULL) + break; + if (strcmp(buf, "exit\n") == 0 || strcmp(buf, "quit\n") == 0) + break; + if ((len = strlen(buf)) <= 1) + continue; + for (t = rbuf, p = buf + (len - 2); p >= buf;) + *t++ = *p--; + *t++ = '\0'; + + key.data = buf; + data.data = rbuf; + data.size = key.size = (u_int32_t)len - 1; + + switch (ret = + dbp->put(dbp, NULL, &key, &data, DB_NOOVERWRITE)) { + case 0: + break; + default: + dbp->err(dbp, ret, "DB->put"); + if (ret != DB_KEYEXIST) + goto err1; + break; + } + } + printf("\n"); + + /* Acquire a cursor for the database. */ + if ((ret = dbp->cursor(dbp, NULL, &dbcp, 0)) != 0) { + dbp->err(dbp, ret, "DB->cursor"); + goto err1; + } + + /* Initialize the key/data pair so the flags aren't set. */ + memset(&key, 0, sizeof(key)); + memset(&data, 0, sizeof(data)); + + /* Walk through the database and print out the key/data pairs. */ + while ((ret = dbcp->get(dbcp, &key, &data, DB_NEXT)) == 0) + printf("%.*s : %.*s\n", + (int)key.size, (char *)key.data, + (int)data.size, (char *)data.data); + if (ret != DB_NOTFOUND) { + dbp->err(dbp, ret, "DBcursor->get"); + goto err2; + } + + /* Close everything down. */ + if ((ret = dbcp->close(dbcp)) != 0) { + dbp->err(dbp, ret, "DBcursor->close"); + goto err1; + } + if ((ret = dbp->close(dbp, 0)) != 0) { + fprintf(stderr, + "%s: DB->close: %s\n", progname, db_strerror(ret)); + return (EXIT_FAILURE); + } + return (EXIT_SUCCESS); + +err2: (void)dbcp->close(dbcp); +err1: (void)dbp->close(dbp, 0); + return (EXIT_FAILURE); +} + +int +dbdemo_usage() +{ + (void)fprintf(stderr, "usage: ex_access [-r] [database]\n"); + return (EXIT_FAILURE); +} diff --git a/db-4.8.30/build_vxworks/dbdemo/dbdemo20.wpj b/db-4.8.30/build_vxworks/dbdemo/dbdemo20.wpj new file mode 100755 index 0000000..04e5edd --- /dev/null +++ b/db-4.8.30/build_vxworks/dbdemo/dbdemo20.wpj @@ -0,0 +1,158 @@ +Document file - DO NOT EDIT + + BUILD_PENTIUMgnu_BUILDRULE +dbdemo20.out + + + BUILD_PENTIUMgnu_MACRO_AR +ar386 + + + BUILD_PENTIUMgnu_MACRO_ARCHIVE +$(PRJ_DIR)/PENTIUMgnu/dbdemo20.a + + + BUILD_PENTIUMgnu_MACRO_AS +cc386 + + + BUILD_PENTIUMgnu_MACRO_CC +cc386 + + + BUILD_PENTIUMgnu_MACRO_CFLAGS +-g \ + -mpentium \ + -ansi \ + -nostdinc \ + -DRW_MULTI_THREAD \ + -D_REENTRANT \ + -fvolatile \ + -nostdlib \ + -fno-builtin \ + -fno-defer-pop \ + -I$(PRJ_DIR)/.. \ + -I$(PRJ_DIR)/../.. \ + -I$(WIND_BASE)/target/h \ + -DCPU=PENTIUM + + + BUILD_PENTIUMgnu_MACRO_CFLAGS_AS +-g \ + -mpentium \ + -ansi \ + -nostdinc \ + -fvolatile \ + -nostdlib \ + -fno-builtin \ + -fno-defer-pop \ + -P \ + -x \ + assembler-with-cpp \ + -I$(WIND_BASE)/target/h \ + -DCPU=PENTIUM + + + BUILD_PENTIUMgnu_MACRO_CPP +cc386 -E -P -xc + + + BUILD_PENTIUMgnu_MACRO_LD +ld386 + + + BUILD_PENTIUMgnu_MACRO_LDDEPS + + + + BUILD_PENTIUMgnu_MACRO_LDFLAGS +-X -N + + + BUILD_PENTIUMgnu_MACRO_LD_PARTIAL_FLAGS +-X -r + + + BUILD_PENTIUMgnu_MACRO_NM +nm386 -g + + + BUILD_PENTIUMgnu_MACRO_OPTION_DEFINE_MACRO +-D + + + BUILD_PENTIUMgnu_MACRO_OPTION_INCLUDE_DIR +-I + + + BUILD_PENTIUMgnu_MACRO_POST_BUILD_RULE + + + + BUILD_PENTIUMgnu_MACRO_PRJ_LIBS + + + + BUILD_PENTIUMgnu_MACRO_SIZE +size386 + + + BUILD_PENTIUMgnu_RO_DEPEND_PATH +{$(WIND_BASE)/target/h/} \ + {$(WIND_BASE)/target/src/} \ + {$(WIND_BASE)/target/config/} + + + BUILD_PENTIUMgnu_TC +::tc_PENTIUMgnu + + + BUILD_RULE_archive + + + + BUILD_RULE_dbdemo20.out + + + + BUILD_RULE_objects + + + + BUILD__CURRENT +PENTIUMgnu + + + BUILD__LIST +PENTIUMgnu + + + CORE_INFO_TYPE +::prj_vxApp + + + CORE_INFO_VERSION +2.0 + + FILE_dbdemo.c_dependDone +FALSE + + + FILE_dbdemo.c_dependencies + + + FILE_dbdemo.c_objects +dbdemo.o + + + FILE_dbdemo.c_tool +C/C++ compiler + + + PROJECT_FILES +$(PRJ_DIR)/dbdemo.c + + + userComments +dbdemo + diff --git a/db-4.8.30/build_vxworks/dbdemo/dbdemo22.wpj b/db-4.8.30/build_vxworks/dbdemo/dbdemo22.wpj new file mode 100755 index 0000000..d2b15f8 --- /dev/null +++ b/db-4.8.30/build_vxworks/dbdemo/dbdemo22.wpj @@ -0,0 +1,192 @@ +Document file - DO NOT EDIT + + BUILD_PENTIUM2gnu_BUILDRULE +dbdemo22.out + + + BUILD_PENTIUM2gnu_MACRO_AR +arpentium + + + BUILD_PENTIUM2gnu_MACRO_ARCHIVE +$(PRJ_DIR)/PENTIUM2gnu/dbdemo22.a + + + BUILD_PENTIUM2gnu_MACRO_AS +ccpentium + + + BUILD_PENTIUM2gnu_MACRO_CC +ccpentium + + + BUILD_PENTIUM2gnu_MACRO_CC_ARCH_SPEC +-mcpu=pentiumpro -march=pentiumpro + + + BUILD_PENTIUM2gnu_MACRO_CFLAGS +-g \ + -mcpu=pentiumpro \ + -march=pentiumpro \ + -ansi \ + -nostdlib \ + -DRW_MULTI_THREAD \ + -D_REENTRANT \ + -fvolatile \ + -fno-builtin \ + -fno-defer-pop \ + -I$(PRJ_DIR)/.. \ + -I$(PRJ_DIR)/../.. \ + -I$(WIND_BASE)/target/h \ + -DCPU=PENTIUM2 \ + -DTOOL_FAMILY=gnu \ + -DTOOL=gnu + + + BUILD_PENTIUM2gnu_MACRO_CFLAGS_AS +-g \ + -mcpu=pentiumpro \ + -march=pentiumpro \ + -ansi \ + -nostdlib \ + -fno-builtin \ + -fno-defer-pop \ + -P \ + -xassembler-with-cpp \ + -I$(WIND_BASE)/target/h \ + -DCPU=PENTIUM2 \ + -DTOOL_FAMILY=gnu \ + -DTOOL=gnu + + + BUILD_PENTIUM2gnu_MACRO_CPP +ccpentium -E -P + + + BUILD_PENTIUM2gnu_MACRO_HEX_FLAGS + + + + BUILD_PENTIUM2gnu_MACRO_LD +ldpentium + + + BUILD_PENTIUM2gnu_MACRO_LDFLAGS +-X -N + + + BUILD_PENTIUM2gnu_MACRO_LD_PARTIAL +ccpentium -r -nostdlib -Wl,-X + + + BUILD_PENTIUM2gnu_MACRO_LD_PARTIAL_FLAGS +-X -r + + + BUILD_PENTIUM2gnu_MACRO_NM +nmpentium -g + + + BUILD_PENTIUM2gnu_MACRO_OPTION_DEFINE_MACRO +-D + + + BUILD_PENTIUM2gnu_MACRO_OPTION_DEPEND +-M -w + + + BUILD_PENTIUM2gnu_MACRO_OPTION_GENERATE_DEPENDENCY_FILE +-MD + + + BUILD_PENTIUM2gnu_MACRO_OPTION_INCLUDE_DIR +-I + + + BUILD_PENTIUM2gnu_MACRO_OPTION_LANG_C +-xc + + + BUILD_PENTIUM2gnu_MACRO_OPTION_UNDEFINE_MACRO +-U + + + BUILD_PENTIUM2gnu_MACRO_POST_BUILD_RULE + + + + BUILD_PENTIUM2gnu_MACRO_PRJ_LIBS + + + + BUILD_PENTIUM2gnu_MACRO_SIZE +sizepentium + + + BUILD_PENTIUM2gnu_MACRO_TOOL_FAMILY +gnu + + + BUILD_PENTIUM2gnu_RO_DEPEND_PATH +{$(WIND_BASE)/target/h/} \ + {$(WIND_BASE)/target/src/} \ + {$(WIND_BASE)/target/config/} + + + BUILD_PENTIUM2gnu_TC +::tc_PENTIUM2gnu + + + BUILD_RULE_archive + + + + BUILD_RULE_dbdemo22.out + + + + BUILD_RULE_dbdemo22.pl + + + + BUILD_RULE_objects + + + + BUILD__CURRENT +PENTIUM2gnu + + + BUILD__LIST +PENTIUM2gnu + + + CORE_INFO_TYPE +::prj_vxApp + + + CORE_INFO_VERSION +2.2 + + FILE_dbdemo.c_dependDone +FALSE + + + FILE_dbdemo.c_dependencies + + + FILE_dbdemo.c_objects +dbdemo.o + + + FILE_dbdemo.c_tool +C/C++ compiler + + + PROJECT_FILES +$(PRJ_DIR)/dbdemo.c + + + userComments +dbdemo + -- cgit v1.2.3