]> git.eshelyaron.com Git - dict.git/commitdiff
ENHANCED: Allow using swipl compiled with GMP
authorEshel Yaron <me@eshelyaron.com>
Wed, 31 Aug 2022 13:52:26 +0000 (16:52 +0300)
committerEshel Yaron <me@eshelyaron.com>
Wed, 31 Aug 2022 13:52:26 +0000 (16:52 +0300)
.build.yml
Makefile
sweep.c
sweep.el

index bd049c2838b733c18c15da4fe9b4f2c89f06bb6a..2f12efe46985c40781f85e1285dab41014a42817 100644 (file)
@@ -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
index f5758a24be1b9ba5c89eccec3d5138aa5392aeae..687b1f51ca85ef175d3d198346ae67bad0a05092 100644 (file)
--- 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 188ada6f553587205e97b04712e9d2e5c02a8638..12a559f525acb88a7624d3aec1deb04efd6eeb52 100644 (file)
--- 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]);
index 10e0059073445dce075a210710d03a53f4b284b5..b43784e2874314abaf68bc163bffb27d677dc4f7 100644 (file)
--- a/sweep.el
+++ b/sweep.el
                                     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 ()