wok-next rev 13126
liblrdf: Add patches to support raptor 2.0.x and clean up.
author | Christopher Rogers <slaxemulator@gmail.com> |
---|---|
date | Wed Jul 04 22:13:34 2012 +0000 (2012-07-04) |
parents | 61cb21c88190 |
children | d846aa26e70f |
files | liblrdf-dev/receipt liblrdf/receipt liblrdf/stuff/md5.patch liblrdf/stuff/pkgconfig-raptor.patch liblrdf/stuff/raptor2.diff |
line diff
1.1 --- a/liblrdf-dev/receipt Wed Jul 04 22:11:55 2012 +0000 1.2 +++ b/liblrdf-dev/receipt Wed Jul 04 22:13:34 2012 +0000 1.3 @@ -14,7 +14,7 @@ 1.4 genpkg_rules() 1.5 { 1.6 mkdir -p $fs/usr/lib 1.7 - cp -a $_pkg/usr/lib/*.*a $fs/usr/lib 1.8 - cp -a $_pkg/usr/lib/pkgconfig $fs/usr/lib 1.9 - cp -a $_pkg/usr/include $fs/usr 1.10 + cp -a $install/usr/lib/*.*a $fs/usr/lib 1.11 + cp -a $install/usr/lib/pkgconfig $fs/usr/lib 1.12 + cp -a $install/usr/include $fs/usr 1.13 }
2.1 --- a/liblrdf/receipt Wed Jul 04 22:11:55 2012 +0000 2.2 +++ b/liblrdf/receipt Wed Jul 04 22:13:34 2012 +0000 2.3 @@ -13,15 +13,20 @@ 2.4 BUILD_DEPENDS="raptor-dev ladspa-dev curl-dev libxslt-dev" 2.5 2.6 # Rules to configure and make the package. 2.7 - 2.8 -compile_rules() { 2.9 - ./configure $CONFIGURE_ARGS && make && make install 2.10 +compile_rules() 2.11 +{ 2.12 + cd $src 2.13 + patch -Np1 -i $stuff/md5.patch 2.14 + patch -Np0 -i $stuff/raptor2.diff 2.15 + patch -Np1 -i $stuff/pkgconfig-raptor.patch 2.16 + autoreconf -vfi 2.17 + ./configure $CONFIGURE_ARGS && make && make install 2.18 } 2.19 2.20 # Rules to gen a SliTaz package suitable for Tazpkg. 2.21 genpkg_rules() 2.22 { 2.23 mkdir -p $fs/usr/lib $fs/usr/share 2.24 - cp -a $_pkg/usr/lib/*so* $fs/usr/lib/ 2.25 - cp -a $_pkg/usr/share/ladspa $fs/usr/share 2.26 + cp -a $install/usr/lib/*so* $fs/usr/lib/ 2.27 + cp -a $install/usr/share/ladspa $fs/usr/share 2.28 }
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/liblrdf/stuff/md5.patch Wed Jul 04 22:13:34 2012 +0000 3.3 @@ -0,0 +1,18 @@ 3.4 +--- liblrdf-0.4.0.orig/src/lrdf_md5.h 3.5 ++++ liblrdf-0.4.0/src/lrdf_md5.h 3.6 +@@ -32,6 +32,15 @@ 3.7 + #ifndef __MD5_H__ 3.8 + #define __MD5_H__ 3.9 + 3.10 ++/* Change function names to prevent symbol conflicts */ 3.11 ++#define md5_init _lrdf_md5_init 3.12 ++#define md5_buffer _lrdf_md5_buffer 3.13 ++#define md5_sig_from_string _lrdf_md5_sig_from_string 3.14 ++#define md5_finish _lrdf_md5_finish 3.15 ++#define md5_process _lrdf_md5_process 3.16 ++#define md5_sig_to_string _lrdf_md5_sig_to_string 3.17 ++#define md5_get_result _lrdf_md5_get_result 3.18 ++ 3.19 + /* 3.20 + * Size of a standard MD5 signature in bytes. This definition is for 3.21 + * external programs only. The MD5 routines themselves reference the
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/liblrdf/stuff/pkgconfig-raptor.patch Wed Jul 04 22:13:34 2012 +0000 4.3 @@ -0,0 +1,9 @@ 4.4 +--- liblrdf-0.4.0/lrdf.pc.in.orig 2011-10-03 19:28:16.702773254 +0000 4.5 ++++ liblrdf-0.4.0/lrdf.pc.in 2011-10-03 19:28:43.003017477 +0000 4.6 +@@ -7,4 +7,5 @@ 4.7 + Version: @VERSION@ 4.8 + Description: liblrdf, a lightweight RDF library with extensions for LADSPA 4.9 + Libs: -L${libdir} -llrdf 4.10 +-Cflags: -I${includedir} 4.11 ++Libs.private: @RAPTOR_LIBS@ 4.12 ++Cflags: @RAPTOR_CFLAGS@ -I${includedir}
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 5.2 +++ b/liblrdf/stuff/raptor2.diff Wed Jul 04 22:13:34 2012 +0000 5.3 @@ -0,0 +1,193 @@ 5.4 +--- src/Makefile.am 5.5 ++++ src/Makefile.am 5.6 +@@ -4,5 +4,5 @@ lib_LTLIBRARIES = liblrdf.la 5.7 + noinst_HEADERS = lrdf_md5.h md5_loc.h ladspa.h 5.8 + 5.9 + liblrdf_la_SOURCES = lrdf.c lrdf_multi.c md5.c 5.10 +-liblrdf_la_LIBADD = -lraptor 5.11 ++liblrdf_la_LIBADD = -lraptor2 5.12 + liblrdf_la_LDFLAGS = -version-info @LRDF_LIBTOOL_VERSION@ 5.13 +--- src/lrdf.c 5.14 ++++ src/lrdf.c 5.15 +@@ -18,6 +18,7 @@ 5.16 + static unsigned int lrdf_uid = 0; /* A unique(ish) id to append to genid's to 5.17 + * avoid clashses */ 5.18 + 5.19 ++static raptor_world *world = NULL; 5.20 + static lrdf_statement *triples = NULL; 5.21 + static lrdf_statement *free_triples; 5.22 + static lrdf_string_hash *resources_hash[LRDF_HASH_SIZE]; 5.23 +@@ -43,8 +44,7 @@ static void lrdf_remove_triple_hash(lrdf_triple_hash ** tbl, 5.24 + lrdf_hash hash, lrdf_statement * s); 5.25 + static void lrdf_add_closure_hash(lrdf_closure_hash ** tbl, 5.26 + lrdf_hash subject, lrdf_hash object); 5.27 +-static void lrdf_store(void *user_data, 5.28 +- const raptor_statement * statement); 5.29 ++static void lrdf_store(void *user_data, raptor_statement * statement); 5.30 + void lrdf_free_statements(lrdf_statement * s); 5.31 + void lrdf_copy_statement(lrdf_statement * from, lrdf_statement * to); 5.32 + void lrdf_rebuild_taxonomic_closure(lrdf_closure_hash ** fwd_tbl, 5.33 +@@ -71,7 +71,7 @@ void lrdf_init() 5.34 + unsigned int i; 5.35 + struct timeval tv; 5.36 + 5.37 +- raptor_init(); 5.38 ++ world = raptor_new_world(); 5.39 + lrdf_more_triples(256); 5.40 + 5.41 + /* A UID to add to genids to make them safer */ 5.42 +@@ -112,7 +112,8 @@ void lrdf_more_triples(int count) 5.43 + 5.44 + void lrdf_cleanup() 5.45 + { 5.46 +- raptor_finish(); 5.47 ++ raptor_free_world(world); 5.48 ++ world = NULL; 5.49 + 5.50 + lrdf_free_string_hash(resources_hash); 5.51 + lrdf_free_string_hash(literals_hash); 5.52 +@@ -232,26 +233,29 @@ void lrdf_remove_matches(lrdf_statement *pattern) 5.53 + } 5.54 + } 5.55 + 5.56 +-static void lrdf_store(void *user_data, const raptor_statement * statement) 5.57 ++static const char *lrdf_term_as_string(char *tmp, int tmp_len, 5.58 ++ const raptor_term *term) 5.59 ++{ 5.60 ++ switch (term->type) { 5.61 ++ case RAPTOR_TERM_TYPE_URI: 5.62 ++ return (const char *) raptor_uri_as_string(term->value.uri); 5.63 ++ case RAPTOR_TERM_TYPE_LITERAL: 5.64 ++ return (const char *) term->value.literal.string; 5.65 ++ case RAPTOR_TERM_TYPE_BLANK: 5.66 ++ snprintf(tmp, tmp_len, "_:%s.%x", term->value.blank.string, lrdf_uid); 5.67 ++ return tmp; 5.68 ++ default: 5.69 ++ return "(?)"; 5.70 ++ } 5.71 ++} 5.72 ++ 5.73 ++static void lrdf_store(void *user_data, raptor_statement * statement) 5.74 + { 5.75 + lrdf_statement *s = lrdf_alloc_statement(); 5.76 + char tmps[128], tmpp[128], tmpo[128]; 5.77 +- char *subj = (char *) statement->subject, 5.78 +- *pred = (char *) statement->predicate, 5.79 +- *obj = (char *) statement->object; 5.80 +- 5.81 +- if (statement->subject_type == RAPTOR_IDENTIFIER_TYPE_ANONYMOUS) { 5.82 +- snprintf(tmps, 127, "_:%s.%x", subj, lrdf_uid); 5.83 +- subj = tmps; 5.84 +- } 5.85 +- if (statement->predicate_type == RAPTOR_IDENTIFIER_TYPE_ANONYMOUS) { 5.86 +- snprintf(tmpp, 127, "_:%s.%x", pred, lrdf_uid); 5.87 +- pred = tmpp; 5.88 +- } 5.89 +- if (statement->object_type == RAPTOR_IDENTIFIER_TYPE_ANONYMOUS) { 5.90 +- snprintf(tmpo, 127, "_:%s.%x", obj, lrdf_uid); 5.91 +- obj = tmpo; 5.92 +- } 5.93 ++ const char *subj = lrdf_term_as_string(tmps, 128, statement->subject), 5.94 ++ *pred = lrdf_term_as_string(tmpp, 128, statement->predicate), 5.95 ++ *obj = lrdf_term_as_string(tmpo, 128, statement->object); 5.96 + 5.97 + s->shash = lrdf_gen_hash(subj); 5.98 + s->phash = lrdf_gen_hash(pred); 5.99 +@@ -261,7 +265,7 @@ static void lrdf_store(void *user_data, const raptor_statement * statement) 5.100 + 5.101 + s->subject = lrdf_check_hash(resources_hash, s->shash, subj); 5.102 + s->predicate = lrdf_check_hash(resources_hash, s->phash, pred); 5.103 +- if (statement->object_type == RAPTOR_IDENTIFIER_TYPE_LITERAL) { 5.104 ++ if (statement->object->type == RAPTOR_TERM_TYPE_LITERAL) { 5.105 + s->object = lrdf_check_hash(literals_hash, s->ohash, obj); 5.106 + s->object_type = lrdf_literal; 5.107 + } else { 5.108 +@@ -537,28 +541,22 @@ void lrdf_rebuild_taxonomic_closure(lrdf_closure_hash ** fwd_tbl, 5.109 + free(pathto); 5.110 + } 5.111 + 5.112 +-static void lrdf_error_handler(void *data, raptor_locator * locator, 5.113 +- const char *message); 5.114 ++static void lrdf_log_handler(void *data, raptor_log_message *message); 5.115 + 5.116 +-static void lrdf_error_handler(void *data, raptor_locator * locator, 5.117 +- const char *message) 5.118 ++static void lrdf_log_handler(void *data, raptor_log_message *message) 5.119 + { 5.120 +- fprintf(stderr, "liblrdf: error - "); 5.121 +- raptor_print_locator(stderr, locator); 5.122 +- fprintf(stderr, " - %s\n", message); 5.123 +- 5.124 +- raptor_parse_abort((raptor_parser*)data); 5.125 +-} 5.126 ++ const char *severity = "error"; 5.127 ++ if (message->level == RAPTOR_LOG_LEVEL_WARN) { 5.128 ++ severity = "warning"; 5.129 ++ } 5.130 + 5.131 +-static void lrdf_warning_handler(void *data, raptor_locator * locator, 5.132 +- const char *message); 5.133 ++ fprintf(stderr, "liblrdf: %s - ", severity); 5.134 ++ raptor_locator_print(message->locator, stderr); 5.135 ++ fprintf(stderr, " - %s\n", message->text); 5.136 + 5.137 +-static void lrdf_warning_handler(void *data, raptor_locator * locator, 5.138 +- const char *message) 5.139 +-{ 5.140 +- fprintf(stderr, "liblrdf: warning - "); 5.141 +- raptor_print_locator(stderr, locator); 5.142 +- fprintf(stderr, " - %s\n", message); 5.143 ++ if (message->level != RAPTOR_LOG_LEVEL_WARN) { 5.144 ++ raptor_parser_parse_abort((raptor_parser*)data); 5.145 ++ } 5.146 + } 5.147 + 5.148 + 5.149 +@@ -593,15 +591,15 @@ int lrdf_read_file_intl(const char *uri) 5.150 + lrdf_hash source; 5.151 + 5.152 + //printf("lrdf: reading %s\n", uri); 5.153 +- ruri = raptor_new_uri(uri); 5.154 +- furi = raptor_new_uri(uri); 5.155 ++ ruri = raptor_new_uri(world, (const unsigned char *) uri); 5.156 ++ furi = raptor_new_uri(world, (const unsigned char *) uri); 5.157 + source = lrdf_gen_hash(uri); 5.158 + lrdf_check_hash(resources_hash, source, uri); 5.159 + 5.160 + if (strstr(uri, ".rdf")) { 5.161 +- parser = raptor_new_parser("rdfxml"); 5.162 ++ parser = raptor_new_parser(world, "rdfxml"); 5.163 + } else { 5.164 +- parser = raptor_new_parser("ntriples"); 5.165 ++ parser = raptor_new_parser(world, "ntriples"); 5.166 + } 5.167 + if (!parser) { 5.168 + fprintf(stderr, "liblrdf: failed to create parser\n"); 5.169 +@@ -609,12 +607,11 @@ int lrdf_read_file_intl(const char *uri) 5.170 + return 1; 5.171 + } 5.172 + 5.173 +- raptor_set_error_handler(parser, parser, lrdf_error_handler); 5.174 +- raptor_set_warning_handler(parser, NULL, lrdf_warning_handler); 5.175 +- raptor_set_statement_handler(parser, &source, lrdf_store); 5.176 +- raptor_set_default_generate_id_parameters(parser, NULL, ++lrdf_uid); 5.177 ++ raptor_world_set_log_handler(world, parser, lrdf_log_handler); 5.178 ++ raptor_parser_set_statement_handler(parser, &source, lrdf_store); 5.179 ++ raptor_world_set_generate_bnodeid_parameters(world, NULL, ++lrdf_uid); 5.180 + 5.181 +- if (raptor_parse_file(parser, furi, ruri)) { 5.182 ++ if (raptor_parser_parse_file(parser, furi, ruri)) { 5.183 + raptor_free_uri(furi); 5.184 + raptor_free_uri(ruri); 5.185 + raptor_free_parser(parser); 5.186 +--- configure.ac 5.187 ++++ configure.ac 5.188 +@@ -18,7 +18,7 @@ 5.189 + AC_HEADER_STDC 5.190 + AC_CHECK_HEADERS([errno.h limits.h stdlib.h string.h unistd.h]) 5.191 + 5.192 +-PKG_CHECK_MODULES(RAPTOR, raptor >= 0.9.11) 5.193 ++PKG_CHECK_MODULES(RAPTOR, raptor2 >= 0.9.11) 5.194 + 5.195 + # Checks for typedefs, structures, and compiler characteristics. 5.196 + AC_C_CONST