Commit 09492d8b authored by Steven Arnow's avatar Steven Arnow

Install headers for dbpbase, move dbp_error_log into dbpbase

parent 733143ec
......@@ -20,6 +20,8 @@ all:
@echo " [INIT] build/include/dbpmgr"
@$(MKDIR) build/include
@$(MKDIR) build/include/dbpmgr
@echo " [INIT] build/include/dbpbase"
@$(MKDIR) build/include/dbpbase
@echo " [ CD ] libdbpbase/"
+@make -C libdbpbase/
@echo " [ CD ] libdbpmgr/"
......@@ -103,3 +105,5 @@ install:
install -m 644 $(STRIP_FLAG) -t "$(PREFIX)/usr/lib/" "$(TOPDIR)/build/lib/libdbpbase.so"
install -d "$(PREFIX)/usr/include/dbpmgr"
install -m 644 -t "$(PREFIX)/usr/include/dbpmgr" $(TOPDIR)/build/include/dbpmgr/*.h
install -d "$(PREFIX)/usr/include/dbpbase"
install -m 644 -t "$(PREFIX)/usr/include/dbpbase" $(TOPDIR)/build/include/dbpbase/*.h
#include "config.h"
#include "desktop.h"
#include <dbpbase/dbpbase.h>
#include <stdio.h>
#include <libintl.h>
#include <locale.h>
#define _(STRING) gettext(STRING)
FILE *dbp_error_log;
void usage(char *name) {
......@@ -21,11 +19,10 @@ int main(int argc, char **argv) {
struct DBPDesktopFile *df;
const char *value;
dbp_error_log = stderr;
setlocale(LC_ALL, "");
textdomain("dbp-run");
dbp_init(NULL);
if (argc < 2)
return usage(argv[0]), -1;
if (!strcmp(argv[1], "--help"))
......
#include <dbpbase/dbpbase.h>
#include <dbpmgr/dbpmgr.h>
#include <stdio.h>
......@@ -7,7 +8,6 @@
#include <locale.h>
#define _(STRING) gettext(STRING)
FILE *dbp_error_log = NULL;
struct FunctionLookup {
char *name;
void (*func)(int argc, char **argv);
......@@ -172,13 +172,13 @@ static struct FunctionLookup lookup[] = {
int main(int argc, char **argv) {
int i;
dbp_error_log = stderr;
setlocale(LC_ALL, "");
textdomain("dbp-run");
if (argc < 2)
exit(usage());
dbp_init(NULL);
if (dbpmgr_server_connect() < 0)
return 1;
for (i = 0; lookup[i].name; i++)
......
......@@ -9,13 +9,12 @@
#include <pthread.h>
#include <dbpmgr/dbpmgr.h>
#include "config.h"
#include <dbpbase/dbpbase.h>
#define HAS_SUFFIX(str, suffix) (strlen((suffix)) < strlen((str)) && !strcmp((str) + strlen((str)) - strlen((suffix)), suffix))
#define HAS_PREFIX(str, prefix) (strstr((str), (prefix)) == (str))
static char *desktop_directory = NULL;
FILE *dbp_error_log;
static char *find_desktop() {
char *desktop_dir, *home_dir, *desktop_path;
......@@ -135,8 +134,7 @@ static void sighndlr(const char *signal, const char *value, void *data) {
int main(int argc, char **argv) {
struct DBPList *list, *next;
(void) argc; (void) argv;
dbp_error_log = stderr;
dbp_config_init();
dbp_init(NULL);
if (!(desktop_directory = find_desktop()))
return 1;
nuke_desktop(desktop_directory);
......
#include <libintl.h>
#include <locale.h>
#include <stdio.h>
#include "meta.h"
#include "config.h"
#include <dbpbase/dbpbase.h>
#define _(STRING) gettext(STRING)
FILE *dbp_error_log;
void usage() {
fprintf(stdout, _("Extracts meta keys from a DBP\n"));
fprintf(stdout, _("By Steven Arnow, 2015, version %s\n"), dbp_config_version_get());
......@@ -23,13 +20,13 @@ int main(int argc, char **argv) {
setlocale(LC_ALL, "");
textdomain("dbp-run");
dbp_error_log = stderr;
if (argc <3) {
usage();
return 1;
}
dbp_init(NULL);
if (dbp_meta_package_open(argv[2], &mp)) {
fprintf(stderr, _("Unable to open package %s\n"), argv[2]);
return 1;
......
......@@ -5,15 +5,12 @@
#include <dirent.h>
#include <string.h>
#include <signal.h>
#include <dbpbase/dbpbase.h>
#include "mountwatch.h"
#include "config.h"
#include "package.h"
#include "dbp.h"
#include "comm.h"
#include "loop.h"
#include "state.h"
FILE *dbp_error_log;
static struct package_s *p_s;
static void sleep_usec(int usec) {
......@@ -141,9 +138,8 @@ int main(int argc, char **argv) {
char *n;
pid_t procid;
dbp_error_log = stderr;
p_s = &p;
if (!dbp_config_init())
if (!dbp_init(NULL))
return -1;
if (!(dbp_error_log = fopen(dbp_config_struct.daemon_log, "w"))) {
dbp_error_log = stderr;
......
......@@ -10,6 +10,8 @@ LDFLAGS += -Wl,-soname,$(LIBBASEFILE)
all: $(OBJFILES) $(DEPENDS)
@echo " [ LD ] $(LIBBASE)"
@$(CC) $(CFLAGS) -o $(LIBBASE) $(OBJFILES) $(LDFLAGS)
@echo " [COPY] Headers into build directory"
@$(CP) *.h $(TOPDIR)/build/include/dbpbase/
@echo "Done."
@echo
......
#ifndef __DBP_CONFIG_H__
#define __DBP_CONFIG_H__
#ifdef _LIBINTERNAL
#include "desktop.h"
#endif
#define DBP_CONFIG_FILE_PATH "/etc/dbp/dbp_config.ini"
struct DBPConfig {
......@@ -42,7 +44,7 @@ struct DBPConfig {
};
int dbp_config_init();
//int dbp_config_init();
extern struct DBPConfig dbp_config_struct;
char *dbp_config_version_get();
void dbp_config_expand_token(char ***target, int *targets, char *token);
......
#define _LIBINTERNAL
#include "dbp.h"
#include "config.h"
#include <stdio.h>
int dbp_config_init();
FILE *dbp_error_log;
int dbp_init(FILE *error_log) {
if (!error_log)
dbp_error_log = stderr;
else
dbp_error_log = error_log;
if (!dbp_config_init())
return 0;
return 1;
}
......@@ -45,5 +45,6 @@
#define DBP_ERROR_MUTILATED -1023 /* Uncleanly removed media with active programs */
extern FILE *dbp_error_log;
int dbp_init(FILE *dbp_error_log);
#endif
#ifndef __DBP_BASE_H__
#define __DBP_BASE_H__
#include <dbpbase/dbp.h>
#include <dbpbase/config.h>
#include <dbpbase/desktop.h>
#include <dbpbase/loop.h>
#include <dbpbase/util.h>
#include <dbpbase/meta.h>
#endif
#define _LIBINTERNAL
#include "loop.h"
#include "util.h"
#include "dbp.h"
......
#define _LIBINTERNAL
#include "dbp.h"
#include "meta.h"
#include <time.h>
......
#ifndef __META_H__
#define __META_H__
#ifdef _LIBINTERNAL
#include "desktop.h"
#endif
struct DBPMetaPackage {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment