From 73ffe026421ace9234c32648b7ada31d9652b344 Mon Sep 17 00:00:00 2001 From: Peter Ludemann Date: Tue, 1 Aug 2023 20:46:00 -0700 Subject: [PATCH] Sync hdt-cpp to latest "develop" commit - modify Makefile due to the changes - configure hdt-cpp via file "configure" instead of Makefile, so that buildenv.sh is created --- .gitignore | 1 + Makefile | 39 ++++++++++++++++++++++++++------------- README.md | 21 ++++++++++++++++----- configure | 16 ++++++++++++++++ hdt-cpp | 2 +- pack.pl | 2 +- prolog/hdt.pl | 2 +- 7 files changed, 62 insertions(+), 21 deletions(-) create mode 100755 configure diff --git a/.gitignore b/.gitignore index 3e9eb48..f63c98b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ *.o *~ +*.a *.so *.dylib .gdbinit diff --git a/Makefile b/Makefile index a97c919..8d0481b 100644 --- a/Makefile +++ b/Makefile @@ -1,34 +1,47 @@ # Build HDT library for SWI-Prolog -HDTHOME=hdt-cpp/hdt-lib +HDTHOME=hdt-cpp +LIBHDT=$(HDTHOME)/libhdt +LIBCDS=$(HDTHOME)/libcds +HDTLIB=$(LIBHDT)/.libs +CDSLIB=$(LIBCDS)/.libs SOBJ= $(PACKSODIR)/hdt4pl.$(SOEXT) -CFLAGS+=-I$(HDTHOME)/include -g -LIBS= -L$(HDTHOME) -lhdt +NPROC:=$(shell expr $$(nproc) + 1) +MAKE_J=-j$(NPROC) +CFLAGS+=-I$(LIBHDT)/include -g +# This doesn't work because the *.so files get picked first: +# LIBS= -L$(HDTLIB) -L$(CDSLIB) -lhdt -lcds +# Instead, we copy the *.a files intothe same directory as $(OBJ) +# - see the rules for $(OBJ2). +LIBS= -Lc -lhdt -lcds OBJ= c/hdt4pl.o +OBJ2= c/libcds.a c/libhdt.a LD=g++ all: $(SOBJ) -$(SOBJ): $(OBJ) +c/libhdt.a: $(HDTLIB)/libhdt.a + ln $(HDTLIB)/libhdt.a c/ + +c/libcds.a: $(CDSLIB)/libcds.a + ln $(CDSLIB)/libcds.a c/ + +$(SOBJ): $(OBJ) $(OBJ2) mkdir -p $(PACKSODIR) $(LD) $(ARCH) $(LDSOFLAGS) -o $@ $< $(LIBS) $(SWISOLIB) -lserd-0 -c/hdt4pl.o: c/hdt4pl.cpp $(HDTHOME)/libhdt.a +c/hdt4pl.o: c/hdt4pl.cpp $(HDTLIB)/libhdt.a $(CDSLIB)/libcds.a $(CC) $(ARCH) $(CFLAGS) -c -o $@ c/hdt4pl.cpp -$(HDTHOME)/.make-senitel: - [ ! -f $(HDTHOME)/Makefile ] || (cd $(HDTHOME) && git reset --hard) - git submodule update --init - sed -i 's/^FLAGS=-O3/FLAGS=-fPIC -O3/' $(HDTHOME)/Makefile - touch $@ +$(HDTLIB)/libhdt.a $(HDTLIB)/libcds.a: FORCE + $(MAKE) -C $(HDTHOME) $(MAKE_J) -$(HDTHOME)/libhdt.a: $(HDTHOME)/.make-senitel - $(MAKE) -C $(HDTHOME) all +FORCE: check:: install:: clean: - rm -f $(OBJ) $(HDTHOME)/.make-senitel + rm -f $(OBJ) $(OBJ2) [ ! -f $(HDTHOME)/Makefile ] || (cd $(HDTHOME) && git reset --hard) [ ! -f $(HDTHOME)/Makefile ] || $(MAKE) -C $(HDTHOME) clean diff --git a/README.md b/README.md index f3ca2a6..1a5d4d2 100644 --- a/README.md +++ b/README.md @@ -17,16 +17,27 @@ Installation on Windows requires more creativity though. ## Installation -1. Install a recent version of Serd: +1. Install a recent version of Serd. One way of doing this +on Ubuntu is: `sudo apt install libserd-0-0 serdi` +The currently installed version can be found by the command `serdi +-v`. The minimum version of Serd is 0.28.0 (see `hdt-cpp/README.md` or +the `before_install` rule in `hdt-cpp/.travis.yml`). + +If that isn't available, it can be installed and built by: ```bash -curl -s http://download.drobilla.net/serd-0.26.0.tar.bz2 | tar -xj && \ - cd serd-0.26.0 && \ - ./waf configure && \ - ./waf && \ +curl -s http://download.drobilla.net/serd-0.30.0.tar.bz2 | tar -xj && \ + cd serd-0.30.0 && \ + python2 ./waf configure && \ + python2 ./waf && \ sudo ./waf install; ``` +You may wish to specify `--prefix=/usr/local` or `--prefix=$HOME/.local` +to `waf configure`. + +You can uninstall by `python2 ./waf uninstall` + 2. Install Raptor2. On Fedora: `sudo dnf install raptor2-devel` diff --git a/configure b/configure new file mode 100755 index 0000000..c153557 --- /dev/null +++ b/configure @@ -0,0 +1,16 @@ +# "configure" calls hdt-cpp's configure with suitable parameters. + +# TODO: The git commands should probably be in a "dependencies" +# step; however, that requires adding +# prolog:build_setp(dependencies, make) to build/make.pl + +set -e -x + +HDTHOME=hdt-cpp + +( [ ! -f ${HDTHOME}/autogen.sh ] || (cd ${HDTHOME} && git reset --hard) ) +git submodule update --init ${HDTHOME} + +cd ${HDTHOME} +./autogen.sh +./configure --prefix=${HOME}/.local CXXFLAGS='-fPIC -O2 -g' CFLAGS='-fPIC -O2 -g' diff --git a/hdt-cpp b/hdt-cpp index d4b5244..d9ae092 160000 --- a/hdt-cpp +++ b/hdt-cpp @@ -1 +1 @@ -Subproject commit d4b5244a7d3f95d03ac8827c6418508c69289fb0 +Subproject commit d9ae092bb37d9fe85558dfb3edfe0bb6ddddf41a diff --git a/pack.pl b/pack.pl index c75471b..28890b0 100644 --- a/pack.pl +++ b/pack.pl @@ -1,5 +1,5 @@ name(hdt). -version('0.5'). +version('0.5.1'). title('Access RDF HDT files'). keywords(['RDF']). author( 'Jan Wielemaker', 'J.Wielemaker@vu.nl' ). diff --git a/prolog/hdt.pl b/prolog/hdt.pl index 92c0ab7..6c475b4 100644 --- a/prolog/hdt.pl +++ b/prolog/hdt.pl @@ -90,7 +90,7 @@ % collection. Options: % % - access(+Access) -% How the file is accessed. On of `map` (map the file +% How the file is accessed. One of `map` (map the file % into memory, default) or `load` (load the content of the % file). % - indexed(+Boolean)