diff options
| -rw-r--r-- | .gitignore | 3 | ||||
| -rw-r--r-- | Cask | 3 | ||||
| -rw-r--r-- | Makefile | 31 | ||||
| -rw-r--r-- | README.org | 33 | ||||
| -rw-r--r-- | server/configure.ac | 3 | ||||
| -rw-r--r-- | test/run-tests.el | 24 |
6 files changed, 67 insertions, 30 deletions
@@ -1,3 +1,6 @@ aux/ dist/ .cask/ +pdf-tools-*.tar +pdf-tools-*/ + @@ -8,5 +8,4 @@ "server/epdfinfo") (development - (depends-on "emacs" "24.3") - (depends-on "tablist" "0.50")) + (depends-on "emacs" "24.3")) @@ -1,12 +1,25 @@ EMACS ?= emacs -EFLAGS = -Q -L $(PWD)/lisp --batch +EFLAGS = -Q -L $(PWD)/lisp --batch + +PACKAGE_VERSION = $(shell sed -ne '1,32s/^;; \+Version: *\([0-9.]\+\) *$$/\1/p' \ + lisp/pdf-tools.el) + +PKGFILE_CONTENT = (define-package "pdf-tools" "$(PACKAGE_VERSION)" \ + "Support library for PDF documents." \ + (quote ((emacs "24.3"))) \ + :keywords \ + (quote ("files" "multimedia"))) + +PACKAGE_NAME = pdf-tools-$(PACKAGE_VERSION) +PACKAGE_DIR = $(PACKAGE_NAME) .PHONY: all clean distclean package bytecompile test check melpa all: package clean: - rm -rf dist + rm -rf -- $(PACKAGE_DIR) + rm -f -- $(PACKAGE_NAME).tar rm -f -- lisp/*.elc ! [ -f server/Makefile ] || $(MAKE) -C server clean @@ -14,13 +27,16 @@ distclean: clean ! [ -f server/Makefile ] || $(MAKE) -C server distclean package: server/epdfinfo - cask package + mkdir -p '$(PACKAGE_DIR)' + cp -u lisp/*.el README server/epdfinfo -t '$(PACKAGE_DIR)' + echo '$(PKGFILE_CONTENT)' > '$(PACKAGE_DIR)/pdf-tools-pkg.el' + tar cf '$(PACKAGE_NAME).tar' '$(PACKAGE_DIR)' install-package: package $(EMACS) $(EFLAGS) --eval \ "(progn (package-initialize) \ (package-install-file \ - \"dist/pdf-tools-$(shell cask version).tar\"))" + \"$(PACKAGE_NAME).tar\"))" server/epdfinfo: server/Makefile $(MAKE) -C server @@ -30,13 +46,16 @@ server/configure: server/configure.ac cd server && ./autogen.sh bytecompile: - cask exec $(EMACS) $(EFLAGS) -f batch-byte-compile lisp/*.el + $(EMACS) $(EFLAGS) -f batch-byte-compile lisp/*.el test: all - cask exec $(EMACS) $(EFLAGS) -l test/run-tests.el + $(EMACS) $(EFLAGS) -l test/run-tests.el $(PACKAGE_NAME).tar check: bytecompile test +print-version: + @[ -n '$(PACKAGE_VERSION)' ] && echo '$(PACKAGE_VERSION)' + install-server-deps: sudo apt-get install gcc g++ make automake autoconf \ libpng-dev libz-dev libpoppler-glib-dev @@ -48,16 +48,12 @@ + Search for occurrences of a string. + Keep track of visited pages via a history. ** Installation - {Insert melpa instructions here.} -*** Lisp Prerequisites - Creating the package via ~make~ as decribed below requires - the [[https://github.com/cask/cask][cask]] and the package itself requires the [[https://github.com/politza/tablist][tablist]] packages. *** Server Prerequisites You'll need GNU Emacs \ge 24.3 and some form of a GNU/Linux OS. Other operating systems are currently not supported (patches welcome). The following instructions assume a Debian-based - system. (On this system prerequisites may be installed - automatically, see [[Compilation]] .) + system. (The prerequisites may be installed automatically on this + kind of systems, see [[Compilation]] .) First make shure a suitable build-system is installed. We need at least a C/C++ compiler (both ~gcc~ and ~g++~), ~make~, ~automake~ @@ -104,25 +100,28 @@ $ make install-server-deps $ make #+end_src - The ~make install-server-deps~ command will install all nescessary - programms and libraries to build the package, though it'll only - work, if ~sudo~ and ~apt-get~ are available. + The ~make install-server-deps~ command will try to install all + nescessary programms and libraries to build the package, though + it'll only work, if ~sudo~ and ~apt-get~ are available. This should compile the source code and create a Emacs Lisp - Package in the ~dist~ directory. Also, the configure script also - tells you at the very end, which features, depending on the + Package in the root directory of the project. The configure script + also tells you at the very end, which features, depending on the libpoppler version, will be available. These commands should give no error, otherwise you are in trouble. *** Installing - If ~make~ produced the ELP file ~dist/pdf-tools-${VERSION}.tar~ - you are fine. This package contains all the nescessary files for - Emacs and may be installed by executing the - command + If ~make~ produced the ELP file ~pdf-tools-${VERSION}.tar~ you are + fine. This package contains all the nescessary files for Emacs + and may be installed by either using +#+begin_src sh + $ make install-package +#+end_src + or executing the Emacs command #+begin_src elisp - M-x package-install-file RET dist/pdf-tools-${VERSION}.tar RET + M-x package-install-file RET pdf-tools-${VERSION}.tar RET #+end_src - + To complete the installation process, you need to activate the package by putting #+begin_src elisp diff --git a/server/configure.ac b/server/configure.ac index b05eea6..64bb243 100644 --- a/server/configure.ac +++ b/server/configure.ac @@ -2,7 +2,8 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.67]) -AC_INIT([epdfinfo], [0.50], [politza@fh-trier.de]) +AC_INIT([epdfinfo], m4_esyscmd_s([cd .. && make print-version]), + [politza@fh-trier.de]) AM_INIT_AUTOMAKE([-Wall -Wno-override foreign]) AC_CONFIG_SRCDIR([epdfinfo.h]) AC_CONFIG_HEADERS([config.h]) diff --git a/test/run-tests.el b/test/run-tests.el index b341d08..bca1676 100644 --- a/test/run-tests.el +++ b/test/run-tests.el @@ -1,9 +1,25 @@ -(cd (file-name-directory load-file-name)) +(require 'package) + +(unless (= 1 (length command-line-args-left)) + (error "Missing package tar or too many arguments")) + +(defvar pdf-tools-package (expand-file-name (car command-line-args-left))) -(defvar pdf-info-epdfinfo-program (expand-file-name "../server/epdfinfo")) -(unless (file-executable-p pdf-info-epdfinfo-program) - (signal 'file-error (list 'file-executable-p pdf-info-epdfinfo-program))) +(unless (and (file-exists-p pdf-tools-package) + (string-match "\\.tar\\'" pdf-tools-package)) + (error "Invalid tar package:" pdf-tools-package)) + +(unless load-file-name + (error "load-file-name is unset")) + +(cd (file-name-directory load-file-name)) +(setq package-user-dir (make-temp-file "package" t)) +(add-hook 'kill-emacs-hook (lambda nil + (when (file-exists-p package-user-dir) + (delete-directory package-user-dir t)))) +(package-initialize) +(package-install-file pdf-tools-package) (dolist (file (directory-files "." t "\\.ert\\'")) (load-file file)) (ert-run-tests-batch-and-exit t) |
