Skip to content

Commit

Permalink
Output now contains the RDF schema
Browse files Browse the repository at this point in the history
side changes:
- Makefile moved to src directory
- RDF base URI changed

Fixes eellak#197

Signed-off-by: Alexios Zavras <[email protected]>
  • Loading branch information
zvr committed Jul 15, 2023
1 parent 9ccdd9f commit 2bf19ad
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 16 deletions.
9 changes: 1 addition & 8 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,5 @@

ACLOCAL_AMFLAGS = -I m4

bin_PROGRAMS = build-recorder
SUBDIRS = src examples benchmark

build_recorder_SOURCES = \
src/tracer.c \
src/hash.c \
src/record.c \
src/main.c

SUBDIRS = examples benchmark
6 changes: 4 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dnl Minimum autoconf version required
AC_PREREQ([2.69])

dnl Where to generate output
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_HEADERS([src/config.h])


dnl Where are the sources
Expand All @@ -35,6 +35,8 @@ AC_PATH_PROG(TIME, time)
AM_CONDITIONAL([HAVE_TIME], [test -n "$TIME"])
AC_CHECK_PROG(AWK, awk, [awk])
AM_CONDITIONAL([HAVE_AWK], [test -n "$AWK"])
AC_CHECK_PROG(XXD, xxd, [xxd])
AM_CONDITIONAL([HAVE_XXD], [test -n "$XXD"])


dnl Checks for libraries
Expand Down Expand Up @@ -111,7 +113,7 @@ dnl Are we building from git checked-out sources, or a tarball?
AM_CONDITIONAL([BUILD_FROM_GIT], [test -d "$srcdir/.git"])

dnl What files to generate
AC_CONFIG_FILES([Makefile examples/Makefile benchmark/Makefile])
AC_CONFIG_FILES([Makefile src/Makefile examples/Makefile benchmark/Makefile])

dnl Finally, generate everything
AC_OUTPUT
2 changes: 1 addition & 1 deletion doc/build-recorder-schema.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (C) 2023 Alexios Zavras
# SPDX-License-Identifier: LGPL-2.1-or-later

@prefix b: <http://example.org/build-recorder#> .
@prefix b: <http://build-recorder.org/rdf#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
Expand Down
21 changes: 21 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright (C) 2023 Alexios Zavras
# Copyright (C) 2023 Fotios Valasiadis
# SPDX-License-Identifier: LGPL-2.1-or-later

bin_PROGRAMS = build-recorder

build_recorder_SOURCES = \
hash.c \
main.c \
record.c \
schema.c \
tracer.c \
$(EMPTY)

SCHEMA = ../doc/build-recorder-schema.ttl


if HAVE_XXD
schema.c: $(SCHEMA)
sed '/^#/d' $^ | $(XXD) -i -n schema > $@
endif
11 changes: 6 additions & 5 deletions src/record.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ record_start(char *fname)
{
fout = fopen(fname, "w");

fprintf(fout,
"@prefix b: <http://example.org/build-recorder#> .\n"
"@prefix : <http://example.org/build-recorder/run#> .\n"
"@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n"
"@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n");
extern char schema[];
extern unsigned int schema_len;

fwrite(schema, sizeof (char), schema_len, fout);

fprintf(fout, "\n\n");
}

static void
Expand Down

0 comments on commit 2bf19ad

Please sign in to comment.