[81671] trunk/dports/textproc/liblrdf

pixilla at macports.org pixilla at macports.org
Wed Aug 3 16:20:21 PDT 2011


Revision: 81671
          http://trac.macports.org/changeset/81671
Author:   pixilla at macports.org
Date:     2011-08-03 16:20:21 -0700 (Wed, 03 Aug 2011)
Log Message:
-----------
textproc/liblrdf: Patch for raptor2. Take maintainership.

Modified Paths:
--------------
    trunk/dports/textproc/liblrdf/Portfile

Added Paths:
-----------
    trunk/dports/textproc/liblrdf/files/
    trunk/dports/textproc/liblrdf/files/patch-raptor2.diff

Modified: trunk/dports/textproc/liblrdf/Portfile
===================================================================
--- trunk/dports/textproc/liblrdf/Portfile	2011-08-03 21:27:12 UTC (rev 81670)
+++ trunk/dports/textproc/liblrdf/Portfile	2011-08-03 23:20:21 UTC (rev 81671)
@@ -5,10 +5,10 @@
 
 name            liblrdf
 version         0.4.0
-revision        1
+revision        2
 categories      textproc
 platforms       darwin
-maintainers     nomaintainer
+maintainers     pixilla
 description     A lightweight RDF library with special support for LADSPA plugins.
 long_description librdf is a library to make it easy to manipulate \
                 RDF files describing LADSPA plugins. It can also be \
@@ -20,8 +20,12 @@
 checksums       md5     327a5674f671c4b360c6353800226877 \
                 sha1    17ce55f692bc52ed12605091b99106255f964b5f \
                 rmd160  2cb371c99552ac3045b72e20786494575ded37d8
-depends_lib     port:raptor
+depends_lib     port:raptor2
 
+# http://projects.archlinux.org/svntogit/packages.git/plain/liblrdf/trunk/raptor2.diff
+patchfiles          patch-raptor2.diff
+patch.pre_args      -p1
+
 use_autoreconf  yes
 
 configure.cppflags-append -I./src -I../src

Added: trunk/dports/textproc/liblrdf/files/patch-raptor2.diff
===================================================================
--- trunk/dports/textproc/liblrdf/files/patch-raptor2.diff	                        (rev 0)
+++ trunk/dports/textproc/liblrdf/files/patch-raptor2.diff	2011-08-03 23:20:21 UTC (rev 81671)
@@ -0,0 +1,197 @@
+diff -ur a/configure.ac b/configure.ac
+--- a/configure.ac	2011-08-03 15:36:29.000000000 -0700
++++ b/configure.ac	2011-08-03 16:04:31.000000000 -0700
+@@ -18,7 +18,7 @@
+ AC_HEADER_STDC
+ AC_CHECK_HEADERS([errno.h limits.h stdlib.h string.h unistd.h])
+ 
+-PKG_CHECK_MODULES(RAPTOR, raptor >= 0.9.11)
++PKG_CHECK_MODULES(RAPTOR, raptor2 >= 0.9.11)
+ 
+ # Checks for typedefs, structures, and compiler characteristics.
+ AC_C_CONST
+Only in b: configure.ac.orig
+diff -ur a/src/Makefile.am b/src/Makefile.am
+--- a/src/Makefile.am	2011-08-03 15:36:29.000000000 -0700
++++ b/src/Makefile.am	2011-08-03 16:04:31.000000000 -0700
+@@ -4,5 +4,5 @@
+ noinst_HEADERS = lrdf_md5.h md5_loc.h ladspa.h
+ 
+ liblrdf_la_SOURCES = lrdf.c lrdf_multi.c md5.c
+-liblrdf_la_LIBADD = -lraptor
++liblrdf_la_LIBADD = -lraptor2
+ liblrdf_la_LDFLAGS = -version-info @LRDF_LIBTOOL_VERSION@
+diff -ur a/src/lrdf.c b/src/lrdf.c
+--- a/src/lrdf.c	2011-08-03 15:36:29.000000000 -0700
++++ b/src/lrdf.c	2011-08-03 16:04:31.000000000 -0700
+@@ -18,6 +18,7 @@
+ static unsigned int lrdf_uid = 0;	/* A unique(ish) id to append to genid's to
+ 					 * avoid clashses */
+ 
++static raptor_world *world = NULL;
+ static lrdf_statement *triples = NULL;
+ static lrdf_statement *free_triples;
+ static lrdf_string_hash *resources_hash[LRDF_HASH_SIZE];
+@@ -43,8 +44,7 @@
+ 				    lrdf_hash hash, lrdf_statement * s);
+ static void lrdf_add_closure_hash(lrdf_closure_hash ** tbl,
+ 				  lrdf_hash subject, lrdf_hash object);
+-static void lrdf_store(void *user_data,
+-		       const raptor_statement * statement);
++static void lrdf_store(void *user_data, raptor_statement * statement);
+ void lrdf_free_statements(lrdf_statement * s);
+ void lrdf_copy_statement(lrdf_statement * from, lrdf_statement * to);
+ void lrdf_rebuild_taxonomic_closure(lrdf_closure_hash ** fwd_tbl,
+@@ -71,7 +71,7 @@
+     unsigned int i;
+     struct timeval tv;
+ 
+-    raptor_init();
++    world = raptor_new_world();
+     lrdf_more_triples(256);
+ 
+     /* A UID to add to genids to make them safer */
+@@ -112,7 +112,8 @@
+ 
+ void lrdf_cleanup()
+ {
+-    raptor_finish();
++    raptor_free_world(world);
++    world = NULL;
+ 
+     lrdf_free_string_hash(resources_hash);
+     lrdf_free_string_hash(literals_hash);
+@@ -232,26 +233,29 @@
+     }
+ }
+ 
+-static void lrdf_store(void *user_data, const raptor_statement * statement)
++static const char *lrdf_term_as_string(char *tmp, int tmp_len,
++				       const raptor_term *term)
++{
++    switch (term->type) {
++    case RAPTOR_TERM_TYPE_URI:
++	return (const char *) raptor_uri_as_string(term->value.uri);
++    case RAPTOR_TERM_TYPE_LITERAL:
++	return (const char *) term->value.literal.string;
++    case RAPTOR_TERM_TYPE_BLANK:
++	snprintf(tmp, tmp_len, "_:%s.%x", term->value.blank.string, lrdf_uid);
++	return tmp;
++    default:
++	return "(?)";
++    }
++}
++
++static void lrdf_store(void *user_data, raptor_statement * statement)
+ {
+     lrdf_statement *s = lrdf_alloc_statement();
+     char tmps[128], tmpp[128], tmpo[128];
+-    char *subj = (char *) statement->subject,
+-	 *pred = (char *) statement->predicate,
+-	 *obj = (char *) statement->object;
+-
+-    if (statement->subject_type == RAPTOR_IDENTIFIER_TYPE_ANONYMOUS) {
+-	snprintf(tmps, 127, "_:%s.%x", subj, lrdf_uid);
+-	subj = tmps;
+-    }
+-    if (statement->predicate_type == RAPTOR_IDENTIFIER_TYPE_ANONYMOUS) {
+-	snprintf(tmpp, 127, "_:%s.%x", pred, lrdf_uid);
+-	pred = tmpp;
+-    }
+-    if (statement->object_type == RAPTOR_IDENTIFIER_TYPE_ANONYMOUS) {
+-	snprintf(tmpo, 127, "_:%s.%x", obj, lrdf_uid);
+-	obj = tmpo;
+-    }
++    const char *subj = lrdf_term_as_string(tmps, 128, statement->subject),
++	       *pred = lrdf_term_as_string(tmpp, 128, statement->predicate),
++	       *obj = lrdf_term_as_string(tmpo, 128, statement->object);
+ 
+     s->shash = lrdf_gen_hash(subj);
+     s->phash = lrdf_gen_hash(pred);
+@@ -261,7 +265,7 @@
+ 
+     s->subject = lrdf_check_hash(resources_hash, s->shash, subj);
+     s->predicate = lrdf_check_hash(resources_hash, s->phash, pred);
+-    if (statement->object_type == RAPTOR_IDENTIFIER_TYPE_LITERAL) {
++    if (statement->object->type == RAPTOR_TERM_TYPE_LITERAL) {
+ 	s->object = lrdf_check_hash(literals_hash, s->ohash, obj);
+ 	s->object_type = lrdf_literal;
+     } else {
+@@ -537,28 +541,22 @@
+     free(pathto);
+ }
+ 
+-static void lrdf_error_handler(void *data, raptor_locator * locator,
+-			       const char *message);
++static void lrdf_log_handler(void *data, raptor_log_message *message);
+ 
+-static void lrdf_error_handler(void *data, raptor_locator * locator,
+-			       const char *message)
++static void lrdf_log_handler(void *data, raptor_log_message *message)
+ {
+-    fprintf(stderr, "liblrdf: error - ");
+-    raptor_print_locator(stderr, locator);
+-    fprintf(stderr, " - %s\n", message);
+-
+-    raptor_parse_abort((raptor_parser*)data);
+-}
++    const char *severity = "error";
++    if (message->level == RAPTOR_LOG_LEVEL_WARN) {
++	severity = "warning";
++    }
+ 
+-static void lrdf_warning_handler(void *data, raptor_locator * locator,
+-				 const char *message);
++    fprintf(stderr, "liblrdf: %s - ", severity);
++    raptor_locator_print(message->locator, stderr);
++    fprintf(stderr, " - %s\n", message->text);
+ 
+-static void lrdf_warning_handler(void *data, raptor_locator * locator,
+-				 const char *message)
+-{
+-    fprintf(stderr, "liblrdf: warning - ");
+-    raptor_print_locator(stderr, locator);
+-    fprintf(stderr, " - %s\n", message);
++    if (message->level != RAPTOR_LOG_LEVEL_WARN) {
++	raptor_parser_parse_abort((raptor_parser*)data);
++    }
+ }
+ 
+ 
+@@ -593,15 +591,15 @@
+     lrdf_hash source;
+ 
+     //printf("lrdf: reading %s\n", uri);
+-    ruri = raptor_new_uri(uri);
+-    furi = raptor_new_uri(uri);
++    ruri = raptor_new_uri(world, (const unsigned char *) uri);
++    furi = raptor_new_uri(world, (const unsigned char *) uri);
+     source = lrdf_gen_hash(uri);
+     lrdf_check_hash(resources_hash, source, uri);
+ 
+     if (strstr(uri, ".rdf")) {
+-	parser = raptor_new_parser("rdfxml");
++	parser = raptor_new_parser(world, "rdfxml");
+     } else {
+-	parser = raptor_new_parser("ntriples");
++	parser = raptor_new_parser(world, "ntriples");
+     }
+     if (!parser) {
+ 	fprintf(stderr, "liblrdf: failed to create parser\n");
+@@ -609,12 +607,11 @@
+ 	return 1;
+     }
+ 
+-    raptor_set_error_handler(parser, parser, lrdf_error_handler);
+-    raptor_set_warning_handler(parser, NULL, lrdf_warning_handler);
+-    raptor_set_statement_handler(parser, &source, lrdf_store);
+-    raptor_set_default_generate_id_parameters(parser, NULL, ++lrdf_uid);
++    raptor_world_set_log_handler(world, parser, lrdf_log_handler);
++    raptor_parser_set_statement_handler(parser, &source, lrdf_store);
++    raptor_world_set_generate_bnodeid_parameters(world, NULL, ++lrdf_uid);
+ 
+-    if (raptor_parse_file(parser, furi, ruri)) {
++    if (raptor_parser_parse_file(parser, furi, ruri)) {
+ 	raptor_free_uri(furi);
+ 	raptor_free_uri(ruri);
+ 	raptor_free_parser(parser);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110803/3ff19124/attachment.html>


More information about the macports-changes mailing list