summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/tagcache.c14
-rw-r--r--apps/tagcache.h6
-rw-r--r--firmware/common/filefuncs.c2
-rw-r--r--firmware/export/filefuncs.h3
-rw-r--r--firmware/export/rbpaths.h4
-rw-r--r--firmware/include/file.h2
-rwxr-xr-xtools/configure10
-rw-r--r--tools/database/database.c29
-rw-r--r--tools/database/database.make54
-rw-r--r--uisimulator/common/io.c2
10 files changed, 62 insertions, 64 deletions
diff --git a/apps/tagcache.c b/apps/tagcache.c
index 1f11f9e49f..7034cacab4 100644
--- a/apps/tagcache.c
+++ b/apps/tagcache.c
@@ -822,6 +822,8 @@ static long find_tag(int tag, int idx_id, const struct index_entry *idx)
822 return result; 822 return result;
823 } 823 }
824 } 824 }
825#else
826 (void)idx_id;
825#endif 827#endif
826 828
827 return idx->tag_seek[tag]; 829 return idx->tag_seek[tag];
@@ -3110,7 +3112,10 @@ static bool commit(void)
3110 return true; 3112 return true;
3111} 3113}
3112 3114
3115#ifndef __PCTOOL__
3113static int tempbuf_handle; 3116static int tempbuf_handle;
3117#endif
3118
3114static void allocate_tempbuf(void) 3119static void allocate_tempbuf(void)
3115{ 3120{
3116 /* Yeah, malloc would be really nice now :) */ 3121 /* Yeah, malloc would be really nice now :) */
@@ -4483,8 +4488,11 @@ void tagcache_screensync_enable(bool state)
4483 tc_stat.syncscreen = state; 4488 tc_stat.syncscreen = state;
4484} 4489}
4485 4490
4486 4491#ifndef __PCTOOL__
4487static void do_tagcache_build(const char *path[]) 4492/* this is called by the database tool to not pull in global_settings */
4493static
4494#endif
4495void do_tagcache_build(const char *path[])
4488{ 4496{
4489 struct tagcache_header header; 4497 struct tagcache_header header;
4490 bool ret; 4498 bool ret;
@@ -4595,6 +4603,7 @@ static void do_tagcache_build(const char *path[])
4595 cpu_boost(false); 4603 cpu_boost(false);
4596} 4604}
4597 4605
4606#ifndef __PCTOOL__
4598void tagcache_build(void) 4607void tagcache_build(void)
4599{ 4608{
4600 char *vect[MAX_STATIC_ROOTS + 1]; /* +1 to ensure NULL sentinel */ 4609 char *vect[MAX_STATIC_ROOTS + 1]; /* +1 to ensure NULL sentinel */
@@ -4606,6 +4615,7 @@ void tagcache_build(void)
4606 4615
4607 do_tagcache_build((const char**)vect); 4616 do_tagcache_build((const char**)vect);
4608} 4617}
4618#endif
4609 4619
4610#ifdef HAVE_TC_RAMCACHE 4620#ifdef HAVE_TC_RAMCACHE
4611static void load_ramcache(void) 4621static void load_ramcache(void)
diff --git a/apps/tagcache.h b/apps/tagcache.h
index c1d0df9bcd..dbe1c92d39 100644
--- a/apps/tagcache.h
+++ b/apps/tagcache.h
@@ -203,13 +203,13 @@ struct tagcache_search {
203 203
204#ifdef __PCTOOL__ 204#ifdef __PCTOOL__
205void tagcache_reverse_scan(void); 205void tagcache_reverse_scan(void);
206/* call this directly instead of tagcache_build in order to not pull
207 * on global_settings */
208void do_tagcache_build(const char *path[]);
206#endif 209#endif
207 210
208const char* tagcache_tag_to_str(int tag); 211const char* tagcache_tag_to_str(int tag);
209 212
210#ifdef CPU_SH
211bool tagcache_is_numeric_tag(int type);
212#endif
213bool tagcache_find_index(struct tagcache_search *tcs, const char *filename); 213bool tagcache_find_index(struct tagcache_search *tcs, const char *filename);
214bool tagcache_check_clauses(struct tagcache_search *tcs, 214bool tagcache_check_clauses(struct tagcache_search *tcs,
215 struct tagcache_search_clause **clause, int count); 215 struct tagcache_search_clause **clause, int count);
diff --git a/firmware/common/filefuncs.c b/firmware/common/filefuncs.c
index fd33f3c6f9..f969a011b7 100644
--- a/firmware/common/filefuncs.c
+++ b/firmware/common/filefuncs.c
@@ -55,6 +55,7 @@ int strip_volume(const char* name, char* namecopy)
55} 55}
56#endif /* #ifdef HAVE_MULTIVOLUME */ 56#endif /* #ifdef HAVE_MULTIVOLUME */
57 57
58#endif /* __PCTOOL__ */
58/* Test file existence, using dircache of possible */ 59/* Test file existence, using dircache of possible */
59bool file_exists(const char *file) 60bool file_exists(const char *file)
60{ 61{
@@ -89,7 +90,6 @@ bool dir_exists(const char *path)
89 return true; 90 return true;
90} 91}
91 92
92#endif /* __PCTOOL__ */
93 93
94#if (CONFIG_PLATFORM & (PLATFORM_NATIVE|PLATFORM_SDL|PLATFORM_MAEMO|PLATFORM_PANDORA)) 94#if (CONFIG_PLATFORM & (PLATFORM_NATIVE|PLATFORM_SDL|PLATFORM_MAEMO|PLATFORM_PANDORA))
95struct dirinfo dir_get_info(DIR* parent, struct dirent *entry) 95struct dirinfo dir_get_info(DIR* parent, struct dirent *entry)
diff --git a/firmware/export/filefuncs.h b/firmware/export/filefuncs.h
index 3d4e73ad9f..92e97f65b0 100644
--- a/firmware/export/filefuncs.h
+++ b/firmware/export/filefuncs.h
@@ -31,10 +31,9 @@
31int strip_volume(const char* name, char* namecopy); 31int strip_volume(const char* name, char* namecopy);
32#endif 32#endif
33 33
34#ifndef __PCTOOL__
35bool file_exists(const char *file); 34bool file_exists(const char *file);
36bool dir_exists(const char *path); 35bool dir_exists(const char *path);
37#endif 36
38extern struct dirinfo dir_get_info(DIR* parent, struct dirent *entry); 37extern struct dirinfo dir_get_info(DIR* parent, struct dirent *entry);
39 38
40#endif /* __INCLUDE_FILEFUNCS_H_ */ 39#endif /* __INCLUDE_FILEFUNCS_H_ */
diff --git a/firmware/export/rbpaths.h b/firmware/export/rbpaths.h
index c60ebdf2af..d50f66d72d 100644
--- a/firmware/export/rbpaths.h
+++ b/firmware/export/rbpaths.h
@@ -30,11 +30,7 @@
30/* name of directory where configuration, fonts and other data 30/* name of directory where configuration, fonts and other data
31 * files are stored */ 31 * files are stored */
32#ifdef __PCTOOL__ 32#ifdef __PCTOOL__
33#undef ROCKBOX_DIR
34#undef ROCKBOX_DIR_LEN
35#undef WPS_DIR 33#undef WPS_DIR
36#define ROCKBOX_DIR "."
37#define ROCKBOX_DIR_LEN 1
38#else 34#else
39 35
40/* ROCKBOX_DIR is now defined in autoconf.h for flexible build types */ 36/* ROCKBOX_DIR is now defined in autoconf.h for flexible build types */
diff --git a/firmware/include/file.h b/firmware/include/file.h
index 0ff94a8168..4ba9c503b4 100644
--- a/firmware/include/file.h
+++ b/firmware/include/file.h
@@ -54,7 +54,7 @@ extern int app_rename(const char* path, const char* newname);
54# define write(x,y,z) sim_write(x,y,z) 54# define write(x,y,z) sim_write(x,y,z)
55# define close(x) sim_close(x) 55# define close(x) sim_close(x)
56# endif 56# endif
57#elif defined(SIMULATOR) 57#elif defined(SIMULATOR) || defined(DBTOOL)
58# define open(x, ...) sim_open(x, __VA_ARGS__) 58# define open(x, ...) sim_open(x, __VA_ARGS__)
59# define creat(x,m) sim_creat(x,m) 59# define creat(x,m) sim_creat(x,m)
60# define remove(x) sim_remove(x) 60# define remove(x) sim_remove(x)
diff --git a/tools/configure b/tools/configure
index b01d505c9a..aa787d3708 100755
--- a/tools/configure
+++ b/tools/configure
@@ -3530,6 +3530,7 @@ fi
3530 toolset=''; 3530 toolset='';
3531 t_cpu=''; 3531 t_cpu='';
3532 GCCOPTS=''; 3532 GCCOPTS='';
3533 rbdir='.'
3533 extradefines="$extradefines -DDEBUG" 3534 extradefines="$extradefines -DDEBUG"
3534 appsdir='$(ROOTDIR)/tools/checkwps'; 3535 appsdir='$(ROOTDIR)/tools/checkwps';
3535 output='checkwps.'${modelname}; 3536 output='checkwps.'${modelname};
@@ -3538,10 +3539,8 @@ fi
3538 ;; 3539 ;;
3539 [Dd]) 3540 [Dd])
3540 uname=`uname` 3541 uname=`uname`
3541 simcc "database" 3542 simcc "database-sdl"
3542 toolset=''; 3543 toolset='';
3543 t_cpu='';
3544 GCCOPTS='';
3545 appsdir='$(ROOTDIR)/tools/database'; 3544 appsdir='$(ROOTDIR)/tools/database';
3546 archosrom=''; 3545 archosrom='';
3547 3546
@@ -3553,7 +3552,10 @@ fi
3553 output='database.'${modelname}; 3552 output='database.'${modelname};
3554 ;; 3553 ;;
3555 esac 3554 esac
3556 3555 # architecture, manufacturer and model for the target-tree build
3556 t_cpu="hosted"
3557 t_manufacturer="sdl"
3558 t_model="database"
3557 echo "Database tool build selected" 3559 echo "Database tool build selected"
3558 ;; 3560 ;;
3559 [Ww]) 3561 [Ww])
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
8int main(int argc, char **argv) 15int 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 */
18bool file_exists(const char *file) 35const 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
10DBDEFINES=-g -DDEBUG -D__PCTOOL__ 10GCCOPTS += -g -DDEBUG -D__PCTOOL__ -DDBTOOL
11CFLAGS+=$(DBDEFINES)
12 11
13createsrc = $(shell cat $(1) > $(3); echo "\#if CONFIG_CODEC == SWCODEC" >> $(3); \ 12createsrc = $(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
24SRC= $(call preprocess, $(SRCFILE)) 23DATABASE_SRC = $(call preprocess, $(SRCFILE))
24DATABASE_OBJ = $(call c2obj,$(DATABASE_SRC))
25 25
26INCLUDES = -I$(ROOTDIR)/apps/gui \ 26OTHER_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
37SIMINCLUDES += -I$(FIRMDIR)/target/hosted/sdl -I$(FIRMDIR)/target/hosted \ 28INCLUDES += -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
41GCCOPTS+=`$(SDLCONFIG) --cflags`
42OLDGCCOPTS:=$(GCCOPTS)
43GCCOPTS+=-D__PCTOOL__ -fno-builtin $(INCLUDES) $(SIMINCLUDES)
44
45LIBS=`$(SDLCONFIG) --libs` -lc
46ifneq ($(findstring MINGW,$(shell uname)),MINGW)
47LIBS += -ldl
48endif
49 39
50.SECONDEXPANSION: # $$(OBJ) is not populated until after this 40.SECONDEXPANSION: # $$(OBJ) is not populated until after this
51 41
52SIMFLAGS += $(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 $@
diff --git a/uisimulator/common/io.c b/uisimulator/common/io.c
index bca5c27a17..7538788bd6 100644
--- a/uisimulator/common/io.c
+++ b/uisimulator/common/io.c
@@ -282,7 +282,7 @@ static ssize_t io_trigger_and_wait(enum io_dir cmd)
282 return result; 282 return result;
283} 283}
284 284
285#if !defined(__PCTOOL__) && !defined(APPLICATION) 285#if !defined(APPLICATION)
286static const char *get_sim_pathname(const char *name) 286static const char *get_sim_pathname(const char *name)
287{ 287{
288 static char buffer[MAX_PATH]; /* sufficiently big */ 288 static char buffer[MAX_PATH]; /* sufficiently big */