summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorShinmera2023-10-01 00:18:48 +0900
committerShinmera2023-10-01 00:20:13 +0900
commitf915f02cdb8e0696db4b6926f459fe28c56fc7f2 (patch)
treefde43df4548f752e1ee944543be23ac21c86fcdd
downloadaur-f915f02cdb8e0696db4b6926f459fe28c56fc7f2.tar.gz
Initial build
-rw-r--r--.SRCINFO31
-rw-r--r--PKGBUILD53
-rw-r--r--build-ncurses.lisp18
-rw-r--r--build-sdl2.lisp29
-rw-r--r--general.lisp53
-rw-r--r--lem.desktop9
6 files changed, 193 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..d531a8912819
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,31 @@
+pkgbase = lem-editor-git
+ pkgdesc = An extensible editor written in Common Lisp
+ pkgver = v2.1.0.645.gc44eba86
+ pkgrel = 1
+ epoch = 0
+ url = https://github.com/lem-project/lem
+ arch = i686
+ arch = x86_64
+ arch = aarch64
+ license = MIT
+ makedepends = sbcl
+ makedepends = sdl2
+ makedepends = ncurses
+ optdepends = sdl2: Graphical client
+ provides = lem-editor
+ conflicts = lem-editor
+ options = !strip
+ source = lem::git+https://github.com/lem-project/lem
+ source = https://qlot.tech/installer
+ source = general.lisp
+ source = build-ncurses.lisp
+ source = build-sdl2.lisp
+ source = lem.desktop
+ b2sums = SKIP
+ b2sums = d44ed1885e334a340372dcfafaf6409b2bc10ea9537445cf7590d0c2ca0fd708279ed15e903c7f4a64bc175d8bccdc703177d0e31faf8e6fce6b4489311c19fc
+ b2sums = c228c6d9b3eb8379b40be04c7caef16698996642405dcbe769cbf3e8a09ff4464d4ed5638ff2cb12346a77cdf2e1f5eee42d7eb13aeb8f80d2f37c458ab82a6f
+ b2sums = c4302f39f5f916f5491f3816d95d60f93502eec4f2d3d8c75f69a464245ed252d89872d2997e907200bac15be39f064e6d69fe2213286dc60650f06fe28e1425
+ b2sums = a56e3dd69583c68f4c4e9b3e04c0ab80becd5e8ef98a2fbc7a7fe4aa27a4a6f4f98ff8dd814b1efbe144fdf59e7456fe707bf23095345bb60b198672418aff51
+ b2sums = ac7b40bcfdb2a4b6c49cd90914b9244215daf86ee99a390815c360d80c43be513a1a115d0aca4e07cbb81ea79ec8e452d15ff5e6b711d9b0b1b7e1b329124b41
+
+pkgname = lem-editor-git
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..e8f74d8b7482
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,53 @@
+# Maintainer: Yukari Hafner <shinmera@tymoon.eu>
+pkgname=lem-editor-git
+pkgrel=1
+pkgver=v2.1.0.645.gc44eba86
+epoch=0
+pkgdesc="An extensible editor written in Common Lisp"
+arch=('i686' 'x86_64' 'aarch64')
+url="https://github.com/lem-project/lem"
+license=('MIT')
+options=("!strip")
+optdepends=('sdl2: Graphical client')
+makedepends=('sbcl' 'sdl2' 'ncurses')
+conflicts=('lem-editor')
+provides=('lem-editor')
+source=("lem::git+https://github.com/lem-project/lem"
+ "https://qlot.tech/installer"
+ "general.lisp"
+ "build-ncurses.lisp"
+ "build-sdl2.lisp"
+ "lem.desktop")
+b2sums=('SKIP'
+ 'd44ed1885e334a340372dcfafaf6409b2bc10ea9537445cf7590d0c2ca0fd708279ed15e903c7f4a64bc175d8bccdc703177d0e31faf8e6fce6b4489311c19fc'
+ 'c228c6d9b3eb8379b40be04c7caef16698996642405dcbe769cbf3e8a09ff4464d4ed5638ff2cb12346a77cdf2e1f5eee42d7eb13aeb8f80d2f37c458ab82a6f'
+ 'c4302f39f5f916f5491f3816d95d60f93502eec4f2d3d8c75f69a464245ed252d89872d2997e907200bac15be39f064e6d69fe2213286dc60650f06fe28e1425'
+ 'a56e3dd69583c68f4c4e9b3e04c0ab80becd5e8ef98a2fbc7a7fe4aa27a4a6f4f98ff8dd814b1efbe144fdf59e7456fe707bf23095345bb60b198672418aff51'
+ 'ac7b40bcfdb2a4b6c49cd90914b9244215daf86ee99a390815c360d80c43be513a1a115d0aca4e07cbb81ea79ec8e452d15ff5e6b711d9b0b1b7e1b329124b41')
+
+pkgver() {
+ cd "$srcdir/lem"
+ git describe | sed s/-/./g
+}
+
+prepare() {
+ if [ ! -d "qlot" ]; then
+ QLOT_HOME="$(pwd)/qlot" bash installer
+ fi
+}
+
+build() {
+ export PATH=$PATH:$(pwd)/qlot/bin/
+ cd "$srcdir/lem"
+ qlot install
+ sbcl --noinform --no-sysinit --no-userinit --load .qlot/setup.lisp --load "$srcdir/build-ncurses.lisp"
+ sbcl --noinform --no-sysinit --no-userinit --load .qlot/setup.lisp --load "$srcdir/build-sdl2.lisp"
+}
+
+package() {
+ mkdir -p "$pkgdir/usr/bin/" "$pkgdir/usr/share/applications/" "$pkgdir/usr/share/lem"
+ cp -r "$srcdir/lem/frontends/sdl2/resources" "$pkgdir/usr/share/lem/"
+ cp "$srcdir/libasyncprocess.so" "$pkgdir/usr/share/lem/"
+ cp "$srcdir/lem/lem" "$srcdir/lem/lem-gui" "$pkgdir/usr/bin/"
+ cp "$srcdir/lem.desktop" "$pkgdir/usr/share/applications/"
+}
diff --git a/build-ncurses.lisp b/build-ncurses.lisp
new file mode 100644
index 000000000000..0bd48d54f4c3
--- /dev/null
+++ b/build-ncurses.lisp
@@ -0,0 +1,18 @@
+(ql:quickload :lem-ncurses)
+
+(cffi:close-foreign-library 'async-process::async-process)
+
+(defun setup-foreign-library-directories ()
+ (setf cffi:*foreign-library-directories* '())
+ (cffi:load-foreign-library "/usr/share/lem/libasyncprocess.so"))
+
+(load (merge-pathnames "general.lisp" *load-pathname*))
+
+(apply #'sb-ext:save-lisp-and-die
+ "lem"
+ :toplevel 'launch
+ :executable t
+ #+sb-core-compression
+ '(:compression -1)
+ #-sb-core-compression
+ '())
diff --git a/build-sdl2.lisp b/build-sdl2.lisp
new file mode 100644
index 000000000000..3a344cad7299
--- /dev/null
+++ b/build-sdl2.lisp
@@ -0,0 +1,29 @@
+(ql:quickload :lem-sdl2)
+
+(cffi:close-foreign-library 'async-process::async-process)
+(cffi:close-foreign-library 'sdl2::libsdl2)
+(cffi:close-foreign-library 'sdl2-ttf::libsdl2-ttf)
+(cffi:close-foreign-library 'sdl2-image::libsdl2-image)
+
+(defun setup-foreign-library-directories ()
+ (setf cffi:*foreign-library-directories* '())
+ (cffi:load-foreign-library "/usr/share/lem/libasyncprocess.so")
+ (cffi:load-foreign-library "libdecor-0.so")
+ (cffi:load-foreign-library "libtiff.so")
+ (cffi:load-foreign-library "libsamplerate.so")
+ (cffi:load-foreign-library "libSDL2.so")
+ (cffi:load-foreign-library "libSDL2_image.so")
+ (cffi:load-foreign-library "libSDL2_ttf.so"))
+
+(load (merge-pathnames "general.lisp" *load-pathname*))
+
+(setf lem-sdl2/resource::*resource-directory* #p"/usr/share/lem/")
+
+(apply #'sb-ext:save-lisp-and-die
+ "lem-gui"
+ :toplevel 'launch
+ :executable t
+ #+sb-core-compression
+ '(:compression -1)
+ #-sb-core-compression
+ '())
diff --git a/general.lisp b/general.lisp
new file mode 100644
index 000000000000..50b2207337c0
--- /dev/null
+++ b/general.lisp
@@ -0,0 +1,53 @@
+(in-package :cl-user)
+
+(setq lem-core::*deployed* t)
+
+(dolist (module sb-impl::*modules*)
+ (require module))
+
+(setq asdf:*output-translations-parameter* nil
+ asdf/output-translations:*output-translations* nil)
+
+;; XXX:
+;; (ql:quickload :drakma) causes sb-bsd-sockets require to fail.
+;; Override this method to work around it.
+(defmethod asdf:perform ((o asdf:load-op) (s asdf:require-system))
+ nil)
+
+(defmethod asdf:output-files :around ((operation t) (component t))
+ (call-next-method)
+ ;; XXX:
+ ;; Disable the following code defined in asdf
+ ;; because the target environment may refer to directories in the host environment
+ #+(or)
+ (do-asdf-cache `(output-files ,operation ,component)
+ (values
+ (multiple-value-bind (pathnames fixedp) (call-next-method)
+ ;; 1- Make sure we have absolute pathnames
+ (let* ((directory (pathname-directory-pathname
+ (component-pathname (find-component () component))))
+ (absolute-pathnames
+ (loop
+ :for pathname :in pathnames
+ :collect (ensure-absolute-pathname pathname directory))))
+ ;; 2- Translate those pathnames as required
+ (if fixedp
+ absolute-pathnames
+ (mapcar *output-translation-function* absolute-pathnames))))
+ t)))
+
+(uiop:copy-file (cffi:foreign-library-pathname (cffi::get-foreign-library 'async-process::async-process))
+ (merge-pathnames #p"libasyncprocess.so" *load-pathname*))
+
+(maphash (lambda (key value)
+ (declare (ignore value))
+ (unless (or (equal key "asdf")
+ (equal key "asdf-package-system")
+ (equal key "uiop")
+ (uiop:string-prefix-p "sb-" key))
+ (remhash key asdf::*registered-systems*)))
+ asdf::*registered-systems*)
+
+(defun launch (&optional (args (uiop:command-line-arguments)))
+ (setup-foreign-library-directories)
+ (apply #'lem:lem args))
diff --git a/lem.desktop b/lem.desktop
new file mode 100644
index 000000000000..273dfeac1453
--- /dev/null
+++ b/lem.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Name=Lem
+GenericName=Text Editor
+Exec=/usr/bin/lem-gui %F
+Comment=An extensible editor written in Common Lisp
+Terminal=false
+Icon=/usr/share/lem/resources/icon.png
+Type=Application
+Category=Development;TextEditor; \ No newline at end of file