+++ /dev/null
-image: debian/stable
-packages:
- - build-essential
- - cmake
- - ninja-build
- - pkg-config
- - ncurses-dev
- - libreadline-dev
- - libedit-dev
- - libgoogle-perftools-dev
- - libgmp-dev
- - libssl-dev
- - unixodbc-dev
- - zlib1g-dev
- - libarchive-dev
- - libossp-uuid-dev
- - libxext-dev
- - libice-dev
- - libjpeg-dev
- - libxinerama-dev
- - libxft-dev
- - libxpm-dev
- - libxt-dev
- - libdb-dev
- - libpcre2-dev
- - libyaml-dev
- - zip
- - git
- - emacs
-secrets:
- - 750079bb-9735-473b-bebf-db897c9f0c6b
- - 72d5c3dc-f83f-4cc2-96e3-b2b08f6ee8a0
-sources:
- - git@git.sr.ht:~eshel/sweep
-tasks:
- - 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
- sudo ninja install
- - build: |
- cd sweep
- export LD_LIBRARY_PATH=/usr/local/lib
- make
- make sweep.info
- LD_PRELOAD=/usr/local/lib/libswipl.so make check
--- /dev/null
+cmake_minimum_required(VERSION 3.5)
+project(swipl-sweep)
+
+include("../cmake/PrologPackage.cmake")
+
+find_program(EMACS Emacs)
+
+find_path(
+ EMACS_INCLUDE_DIR
+ NAMES "emacs-module.h"
+ PATHS /Applications/Emacs.app/Contents/Resources/include
+)
+
+if(EMACS_INCLUDE_DIR)
+
+swipl_plugin(
+ sweep-module
+ C_SOURCES sweep.c
+ C_INCLUDE_DIR ${EMACS_INCLUDE_DIR}
+ PL_LIBS sweep.pl)
+
+endif(EMACS_INCLUDE_DIR)
+++ /dev/null
-BASENAME = sweep
-
-UNAME_S := $(shell uname -s)
-ifeq ($(UNAME_S),Linux)
- SOEXT = so
-endif
-ifeq ($(UNAME_S),Darwin)
- SOEXT = dylib
-endif
-
-SWIPL ?= swipl
-SWIPLBASE = $(shell $(SWIPL) --dump-runtime-variables | grep PLBASE | cut -f 2 -d = | cut -f 1 -d ';')
-SWIPLLIBDIR = $(shell $(SWIPL) --dump-runtime-variables | grep PLLIBDIR | cut -f 2 -d = | cut -f 1 -d ';')
-
-EMACS ?= emacs
-
-TARGET = $(BASENAME)-module.$(SOEXT)
-OBJECT = $(BASENAME).o
-SOURCE = $(BASENAME).c
-
-LDFLAGS += -shared
-LDFLAGS += -L$(SWIPLLIBDIR)
-LDFLAGS += -lswipl
-
-CFLAGS += -fPIC
-CFLAGS += -Wall
-CFLAGS += -Wextra
-CFLAGS += -O2
-CFLAGS += -I$(SWIPLBASE)/include
-
-.PHONY: clean all check info
-
-all: $(TARGET)
-
-$(OBJECT): $(SOURCE)
- $(CC) $(CFLAGS) -o $@ -c $(SOURCE)
-
-$(TARGET): $(OBJECT)
- $(CC) -o $@ $(OBJECT) $(LDFLAGS)
-
-clean:
- rm -f $(TARGET) $(OBJECT) $(BASENAME).info $(BASENAME).texi $(BASENAME).html
-
-info: $(BASENAME).info
-$(BASENAME).info:: README.org
- $(EMACS) -Q --batch --eval "(require '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)))"
-
-check: $(TARGET)
- $(EMACS) --batch --eval '(add-to-list (quote load-path) (expand-file-name "."))' \
- -l ert -l sweep -l sweep-tests.el -f ert-run-tests-batch-and-exit
:type 'boolean
:group 'sweep)
-(defcustom sweep-init-args (list (expand-file-name
- "sweep.pl"
- (file-name-directory load-file-name)))
+(defcustom sweep-init-args (list "-q"
+ "--no-signals"
+ "-g [library(sweep)]")
"List of strings used as initialization arguments for Prolog."
:package-version '((sweep "0.1.0"))
:type '(list string)
(declare-function sweep-cleanup "sweep-module")
(defun sweep--ensure-module ()
- (unless (require 'sweep-module nil t)
- (if (y-or-n-p "Sweep needs `sweep-module' to work. Compile it now? ")
- (progn
- (sweep--compile-module)
- (require 'sweep-module))
- (error "Sweep will not work until `sweep-module' is compiled!"))))
+ (let ((swipl-lib-dir (car
+ (split-string-and-unquote
+ (shell-command-to-string
+ (concat
+ (or sweep-swipl-path (executable-find "swipl"))
+ " --dump-runtime-variables |"
+ " grep PLLIBDIR |"
+ " cut -f 2 -d = |"
+ " cut -f 1 -d ';'"))))))
+ (load (expand-file-name "sweep-module" swipl-lib-dir))))
(defface sweep-debug-prefix-face
(defun sweep-init ()
(apply #'sweep-initialize
(cons (or sweep-swipl-path (executable-find "swipl"))
- (cons "-q" (cons "--no-signals" sweep-init-args))))
+ sweep-init-args))
(sweep-setup-message-hook)
(sweep-start-prolog-server))