emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/sweeprolog 521a4bfde5 132/166: BUILD: replaced Makefile wi


From: ELPA Syncer
Subject: [nongnu] elpa/sweeprolog 521a4bfde5 132/166: BUILD: replaced Makefile with CMakeLists.txt
Date: Fri, 30 Sep 2022 04:59:32 -0400 (EDT)

branch: elpa/sweeprolog
commit 521a4bfde514f8cdb13df3c1cf9c7779b335933a
Author: Eshel Yaron <me@eshelyaron.com>
Commit: Eshel Yaron <me@eshelyaron.com>

    BUILD: replaced Makefile with CMakeLists.txt
---
 .build.yml     | 52 ----------------------------------------------------
 CMakeLists.txt | 22 ++++++++++++++++++++++
 Makefile       | 51 ---------------------------------------------------
 sweep.el       | 24 ++++++++++++++----------
 4 files changed, 36 insertions(+), 113 deletions(-)

diff --git a/.build.yml b/.build.yml
deleted file mode 100644
index 255b3c027c..0000000000
--- a/.build.yml
+++ /dev/null
@@ -1,52 +0,0 @@
-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
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000000..2f2f561a61
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,22 @@
+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)
diff --git a/Makefile b/Makefile
deleted file mode 100644
index ca0f96d6c0..0000000000
--- a/Makefile
+++ /dev/null
@@ -1,51 +0,0 @@
-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
diff --git a/sweep.el b/sweep.el
index a9c9c311b0..9291e97b75 100644
--- a/sweep.el
+++ b/sweep.el
@@ -121,9 +121,9 @@ inserted to the input history in `sweep-top-level-mode' 
buffers."
   :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)
@@ -156,12 +156,16 @@ inserted to the input history in `sweep-top-level-mode' 
buffers."
 (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
@@ -301,7 +305,7 @@ FLAG and VALUE are specified as strings and read as Prolog 
terms."
 (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))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]