~duncan-bayne/mobili

A toolkit for awesome mobile development in Common Lisp on the PinePhone ARM64 system.

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~duncan-bayne/mobili
read/write
git@git.sr.ht:~duncan-bayne/mobili

You can also use your local clone with git send-email.

#mobili

A toolkit for awesome mobile development in Common Lisp on the PinePhone ARM64 system.

#how does it work?

Mobili provides an interactive mobile application development environment.

How it works

The developer uses the SLIME environment in Emacs to create and edit the application, while it's running.

Behind the scenes, SLIME is driving an instance of Common Lisp that's running on the PinePhone itself, which in turn hosts the application under development.

The developer driving SLIME is also interacting with the running application on the PinePhone, continually testing and evaluating changes in a very fast feedback loop.

#getting started

#installation on the PinePhone

  1. Install the Mobian OS on the phone.

  2. From Software, install the Xfce Terminal.

  3. Install ShellCheck, Git, and tmux:

    sudo apt-get install -y git shellcheck tmux

  4. Clone this repo:

    git clone https://gitlab.com/duncan-bayne/mobili

  5. Install development tools:

    ./scripts/install-mobile.sh

#installation on the development machine

  1. Install ShellCheck, Git, and Emacs:

    sudo apt-get install -y git shellcheck emacs

  2. Clone this repo:

    git clone https://gitlab.com/duncan-bayne/mobili

  3. Install development tools:

    ./scripts/install-dev.sh

#starting the development environment

#on the PinePhone
  1. Start the SBCL instance running:

    ./scripts/start-mobile.ros

#on the development machine
  1. Create the SSH tunnel between your development machine and the PinePhone:

    ./scripts/start-dev.sh

  2. Open Emacs, and run SLIME with M-x slime-connect. Choose localhost as the hostname, and 4005 as the port number. After a moment, SLIME will connect to the instance of SBCL running on the PinePhone.

#running a Hello World app

#on the development machine

In the SLIME REPL, run the following program:

(ql:quickload :mcclim)
(in-package :clim-user)

(define-application-frame hello-world ()
  ((greeting :initform "Hello World"
			 :accessor greeting))
  (:pane (make-pane 'hello-world-pane)))

(defclass hello-world-pane
  (clim-stream-pane) ())

(defmethod handle-repaint ((pane hello-world-pane) region)
  (let ((w (bounding-rectangle-width pane))
  (h (bounding-rectangle-height pane)))

	(draw-rectangle* pane 0 0 w h
		 :filled t
		 :ink (pane-background pane))

	(draw-text* pane
	(greeting *application-frame*)
	(floor w 2) (floor h 2)
	:align-x :center
	:align-y :center)))

(defun run-hello-world()
  (run-frame-top-level (make-application-frame 'hello-world)))

(sb-posix:setenv "DISPLAY" ":0" 1)
(run-hello-world)

This will cause a Hello World window to appear on the PinePhone screen!

Hello world

Close the Hello World app on the PinePhone and SLIME will return you to the prompt.

#thanks