diff options
author | Thomas Martitz <kugel@rockbox.org> | 2012-07-31 10:33:27 +0200 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2012-07-31 10:33:27 +0200 |
commit | efe73e143ad8997a791b895c9ee21a68b6570429 (patch) | |
tree | d206dd97632286975a271ea1502f35b56165767f /tools/database | |
parent | b358bcfc25272cb03dc95809c0c82688943f0f84 (diff) | |
download | rockbox-efe73e143ad8997a791b895c9ee21a68b6570429.tar.gz rockbox-efe73e143ad8997a791b895c9ee21a68b6570429.zip |
Fix database tool.
It was also broken functionally, probably since a while.So restore the
functionality. Run it on the dap, the tcd files will be placed into .rockbox folder.
Change-Id: Id7a6ce4389dfaf99799258902be80d630af0601c
Diffstat (limited to 'tools/database')
-rw-r--r-- | tools/database/database.c | 29 | ||||
-rw-r--r-- | tools/database/database.make | 54 |
2 files changed, 37 insertions, 46 deletions
diff --git a/tools/database/database.c b/tools/database/database.c index 0f9304eb0a..30f1c39626 100644 --- a/tools/database/database.c +++ b/tools/database/database.c | |||
@@ -2,26 +2,37 @@ | |||
2 | 2 | ||
3 | #include <stdbool.h> | 3 | #include <stdbool.h> |
4 | #include <stdio.h> | 4 | #include <stdio.h> |
5 | #include <errno.h> | ||
5 | #include <sys/stat.h> | 6 | #include <sys/stat.h> |
7 | |||
8 | #include "config.h" | ||
6 | #include "tagcache.h" | 9 | #include "tagcache.h" |
10 | #include "dir.h" | ||
11 | |||
12 | /* This is meant to be run on the root of the dap. it'll put the db files into | ||
13 | * a .rockbox subdir */ | ||
7 | 14 | ||
8 | int main(int argc, char **argv) | 15 | int main(int argc, char **argv) |
9 | { | 16 | { |
17 | (void)argc; | ||
18 | (void)argv; | ||
19 | |||
20 | errno = 0; | ||
21 | if (mkdir(ROCKBOX_DIR) == -1 && errno != EEXIST) | ||
22 | return 1; | ||
23 | |||
24 | /* / is actually ., will get translated in io.c | ||
25 | * (with the help of sim_root_dir below */ | ||
26 | const char *paths[] = { "/", NULL }; | ||
10 | tagcache_init(); | 27 | tagcache_init(); |
11 | tagcache_build("."); | 28 | do_tagcache_build(paths); |
12 | tagcache_reverse_scan(); | 29 | tagcache_reverse_scan(); |
13 | 30 | ||
14 | return 0; | 31 | return 0; |
15 | } | 32 | } |
16 | 33 | ||
17 | /* stub to avoid including all of apps/misc.c */ | 34 | /* needed for io.c */ |
18 | bool file_exists(const char *file) | 35 | const char *sim_root_dir = "."; |
19 | { | ||
20 | struct stat s; | ||
21 | if (!stat(file, &s)) | ||
22 | return true; | ||
23 | return false; | ||
24 | } | ||
25 | 36 | ||
26 | /* stubs to avoid including thread-sdl.c */ | 37 | /* stubs to avoid including thread-sdl.c */ |
27 | #include "kernel.h" | 38 | #include "kernel.h" |
diff --git a/tools/database/database.make b/tools/database/database.make index 49ad2ff9bc..89a4aa7d85 100644 --- a/tools/database/database.make +++ b/tools/database/database.make | |||
@@ -7,8 +7,7 @@ | |||
7 | # $Id: checkwps.make 22680 2009-09-11 17:58:17Z gevaerts $ | 7 | # $Id: checkwps.make 22680 2009-09-11 17:58:17Z gevaerts $ |
8 | # | 8 | # |
9 | 9 | ||
10 | DBDEFINES=-g -DDEBUG -D__PCTOOL__ | 10 | GCCOPTS += -g -DDEBUG -D__PCTOOL__ -DDBTOOL |
11 | CFLAGS+=$(DBDEFINES) | ||
12 | 11 | ||
13 | createsrc = $(shell cat $(1) > $(3); echo "\#if CONFIG_CODEC == SWCODEC" >> $(3); \ | 12 | createsrc = $(shell cat $(1) > $(3); echo "\#if CONFIG_CODEC == SWCODEC" >> $(3); \ |
14 | echo $(2) | sed 's/ /\n/g' >> $(3); \ | 13 | echo $(2) | sed 's/ /\n/g' >> $(3); \ |
@@ -21,44 +20,25 @@ SRCFILE := $(call createsrc, $(TOOLSDIR)/database/SOURCES, \ | |||
21 | $(METADATAS), \ | 20 | $(METADATAS), \ |
22 | $(TOOLSDIR)/database/SOURCES.build) | 21 | $(TOOLSDIR)/database/SOURCES.build) |
23 | 22 | ||
24 | SRC= $(call preprocess, $(SRCFILE)) | 23 | DATABASE_SRC = $(call preprocess, $(SRCFILE)) |
24 | DATABASE_OBJ = $(call c2obj,$(DATABASE_SRC)) | ||
25 | 25 | ||
26 | INCLUDES = -I$(ROOTDIR)/apps/gui \ | 26 | OTHER_SRC += $(DATABASE_SRC) |
27 | -I$(ROOTDIR)/firmware/export \ | ||
28 | -I$(ROOTDIR)/firmware/include \ | ||
29 | -I$(ROOTDIR)/apps \ | ||
30 | -I$(ROOTDIR)/apps/recorder \ | ||
31 | -I$(ROOTDIR)/lib/rbcodec \ | ||
32 | -I$(ROOTDIR)/lib/rbcodec/metadata \ | ||
33 | -I$(ROOTDIR)/lib/rbcodec/dsp \ | ||
34 | -I$(APPSDIR) \ | ||
35 | -I$(BUILDDIR) \ | ||
36 | 27 | ||
37 | SIMINCLUDES += -I$(FIRMDIR)/target/hosted/sdl -I$(FIRMDIR)/target/hosted \ | 28 | INCLUDES += -I$(ROOTDIR)/apps/gui \ |
38 | -I$(ROOTDIR)/uisimulator/common -I$(FIRMDIR)/export -I$(BUILDDIR) -I$(APPSDIR) | 29 | -I$(ROOTDIR)/firmware/export \ |
30 | -I$(ROOTDIR)/firmware/include \ | ||
31 | -I$(ROOTDIR)/apps \ | ||
32 | -I$(ROOTDIR)/apps/recorder \ | ||
33 | -I$(ROOTDIR)/lib/rbcodec \ | ||
34 | -I$(ROOTDIR)/lib/rbcodec/metadata \ | ||
35 | -I$(ROOTDIR)/lib/rbcodec/dsp \ | ||
36 | -I$(APPSDIR) \ | ||
37 | -I$(BUILDDIR) | ||
39 | 38 | ||
40 | # Makes mkdepfile happy | ||
41 | GCCOPTS+=`$(SDLCONFIG) --cflags` | ||
42 | OLDGCCOPTS:=$(GCCOPTS) | ||
43 | GCCOPTS+=-D__PCTOOL__ -fno-builtin $(INCLUDES) $(SIMINCLUDES) | ||
44 | |||
45 | LIBS=`$(SDLCONFIG) --libs` -lc | ||
46 | ifneq ($(findstring MINGW,$(shell uname)),MINGW) | ||
47 | LIBS += -ldl | ||
48 | endif | ||
49 | 39 | ||
50 | .SECONDEXPANSION: # $$(OBJ) is not populated until after this | 40 | .SECONDEXPANSION: # $$(OBJ) is not populated until after this |
51 | 41 | ||
52 | SIMFLAGS += $(SIMINCLUDES) $(DBDEFINES) -DHAVE_CONFIG_H $(OLDGCCOPTS) $(INCLUDES) | 42 | $(BUILDDIR)/$(BINARY): $$(DATABASE_OBJ) |
53 | 43 | $(call PRINTS,LD $(BINARY)) | |
54 | $(BUILDDIR)/$(BINARY): $$(OBJ) | 44 | $(SILENT)$(HOSTCC) -o $@ $+ |
55 | @echo LD $(BINARY) | ||
56 | $(SILENT)$(HOSTCC) $(SIMFLAGS) $(LIBS) -o $@ $+ | ||
57 | |||
58 | $(BUILDDIR)/tools/database/../../uisimulator/%.o: $(ROOTDIR)/uisimulator/%.c | ||
59 | $(SILENT)mkdir -p $(dir $@) | ||
60 | $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(SIMFLAGS) -c $< -o $@ | ||
61 | |||
62 | $(BUILDDIR)/tools/database/database.o: $(APPSDIR)/database.c | ||
63 | $(SILENT)mkdir -p $(dir $@) | ||
64 | $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(SIMFLAGS) -c $< -o $@ | ||