branch: externals/xeft
commit 9ee7d6026cb79ebec440109329911c2510710c2a
Author: Yuan Fu <caso...@gmail.com>
Commit: Yuan Fu <caso...@gmail.com>

    Support customizing the compilation command
    
    * Makefile: Use ?=.
    * xeft.el (xeft-compile-args): New variable.
    (xeft--compile-module): Use xeft-compile-args if it's non-nil.
---
 Makefile |  6 +++---
 xeft.el  | 13 ++++++++++---
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index 45d2c036b1..23a3ca636e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,9 @@
 .POSIX:
 PREFIX ?= /usr/local
 CXX ?= g++
-CXXFLAGS = -fPIC -I$(PREFIX)/include -std=c++11
-LDFLAGS = -L$(PREFIX)/lib
-LDLIBS = -lxapian
+CXXFLAGS ?= -fPIC -I$(PREFIX)/include -std=c++11
+LDFLAGS ?= -L$(PREFIX)/lib
+LDLIBS ?= -lxapian
 
 # Dylib extensions.
 ifeq ($(OS),Windows_NT)
diff --git a/xeft.el b/xeft.el
index cc3f96685b..5d8db352a8 100644
--- a/xeft.el
+++ b/xeft.el
@@ -242,6 +242,11 @@ from the database, you need to delete the database on disk 
and
 let xeft recreate it."
   :type 'function)
 
+(defcustom xeft-compile-args nil
+  "Compilation flags for compiling xeft-lite.
+If non-nil, Xeft passes this list of args to make to compile xeft-lite."
+  :type '(list string))
+
 ;;; Compile
 
 (defun xeft--compile-module ()
@@ -252,11 +257,13 @@ let xeft recreate it."
   (let* ((default-directory
           (file-name-directory
            (locate-library "xeft.el" t)))
-         (prefix (concat "PREFIX="
-                         (read-string "PREFIX (empty by default): ")))
+         (args
+          (or xeft-compile-args
+              (list (concat "PREFIX="
+                            (read-string "PREFIX (empty by default): ")))))
          (buffer (get-buffer-create "*xeft compile*")))
     (if (zerop (let ((inhibit-read-only t))
-                 (call-process "make" nil buffer t prefix)))
+                 (apply #'call-process "make" nil buffer t args)))
         (progn (message "Successfully compiled the module :-D") t)
       (pop-to-buffer buffer)
       (compilation-mode)

Reply via email to