From: Eshel Yaron Date: Wed, 31 Aug 2022 13:52:26 +0000 (+0300) Subject: ENHANCED: Allow using swipl compiled with GMP X-Git-Tag: v0.2.0~64 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=4e4d8508cde67470ed8cc165499fd8302b70d737;p=dict.git ENHANCED: Allow using swipl compiled with GMP --- diff --git a/.build.yml b/.build.yml index bd049c2..2f12efe 100644 --- a/.build.yml +++ b/.build.yml @@ -33,11 +33,19 @@ secrets: sources: - git@git.sr.ht:~eshel/sweep tasks: - - build: | - cd sweep + - getswipl: | + git clone --recursive https://github.com/SWI-Prolog/swipl-devel.git + cd swipl-devel + mkdir build + cd build export LANG="en_US.UTF-8" sudo localectl set-locale LANG=en_US.UTF-8 localectl set-locale LANG=en_US.UTF-8 + cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DSWIPL_INSTALL_IN_LIB=ON -DSWIPL_PACKAGES_ODBC=OFF -DSWIPL_PACKAGES_JAVA=OFF -DSWIPL_PACKAGES_X=OFF -DINSTALL_DOCUMENTATION=OFF -G Ninja .. + ninja + ninja install + - build: | + cd sweep make make sweep.info - LD_PRELOAD=lib/libswipl.so make check + make check diff --git a/Makefile b/Makefile index f5758a2..687b1f5 100644 --- a/Makefile +++ b/Makefile @@ -15,45 +15,27 @@ OBJECT = $(BASENAME).o SOURCE = $(BASENAME).c LDFLAGS += -shared -LDFLAGS += -Llib LDFLAGS += -lswipl CFLAGS += -fPIC CFLAGS += -Wall CFLAGS += -Wextra CFLAGS += -O2 -CFLAGS += -Ilib/swipl/include - -CMAKE_OPTIONS += -DCMAKE_INSTALL_PREFIX=$(CURRENT_DIR) -CMAKE_OPTIONS += -DUSE_GMP=OFF -CMAKE_OPTIONS += -DSWIPL_PACKAGES_ODBC=OFF -CMAKE_OPTIONS += -DSWIPL_PACKAGES_JAVA=OFF -CMAKE_OPTIONS += -DSWIPL_PACKAGES_X=OFF -CMAKE_OPTIONS += -DSWIPL_INSTALL_IN_LIB=ON +CFLAGS += -I/usr/local/lib/swipl/include .PHONY: clean all swipl check all: $(TARGET) -$(OBJECT): $(SOURCE) lib/libswipl.$(SOEXT) +$(OBJECT): $(SOURCE) $(CC) $(CFLAGS) -o $@ -c $(SOURCE) $(TARGET): $(OBJECT) $(CC) -o $@ $(OBJECT) $(LDFLAGS) clean: - rm -rf bin lib share swipl/build rm -f $(TARGET) $(OBJECT) $(BASENAME).info -lib/libswipl.$(SOEXT): - cd swipl; \ - rm -rf build; \ - mkdir build; \ - cd build; \ - cmake $(CMAKE_OPTIONS) -G Ninja ..; \ - ninja; \ - ninja install - $(BASENAME).info:: README.org emacs -Q --batch --eval '(require (quote ox-texinfo))' --eval "(with-current-buffer (find-file \"README.org\") (org-export-to-file (quote texinfo) \"$@\" nil nil nil nil nil (quote org-texinfo-compile)))" diff --git a/sweep.c b/sweep.c index 188ada6..12a559f 100644 --- a/sweep.c +++ b/sweep.c @@ -426,6 +426,7 @@ sweep_initialize(emacs_env *env, ptrdiff_t nargs, emacs_value *args, void *data) return NULL; } } + PL_action(PL_GMP_SET_ALLOC_FUNCTIONS, FALSE); r = PL_initialise(nargs, argv); for (i = 0; i < nargs; i++) { free(argv[i]); diff --git a/sweep.el b/sweep.el index 10e0059..b43784e 100644 --- a/sweep.el +++ b/sweep.el @@ -116,8 +116,8 @@ sweep-prolog-server-port)) (apply #'sweep-initialize (cons (expand-file-name "bin/swipl" (file-name-directory - load-file-name)) - (cons "-q" sweep-init-args))) + (buffer-file-name))) + (cons "-q" (cons "--no-signals" sweep-init-args)))) (sweep-start-prolog-server)) (defun sweep-predicates-collection ()