| 1 | #+TITLE: Notes on Packaging ABCL for Distribution |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | * ABCL-AIO |
|---|
| 5 | |
|---|
| 6 | The standard ABCL build process as described in the ~build.xml~ file |
|---|
| 7 | and executed by the Ant build tool results in two archive artifacts: |
|---|
| 8 | ~abcl.jar~ and ~abcl-contrib.jar~. ~abcl.jar~ contains all the Java |
|---|
| 9 | and Common Lisp code necessary that constitute the ANSI conforming |
|---|
| 10 | implementation runtime, plus the latest stable ASDF. The |
|---|
| 11 | ~abcl-contrib.jar~ (aka "contrib") artifact contains additional Common |
|---|
| 12 | Lisp-only code that extends the implementation in useful manners. At |
|---|
| 13 | some point in the future, |
|---|
| 14 | |
|---|
| 15 | We create two separate jar artifacts in order to: |
|---|
| 16 | |
|---|
| 17 | 1. Place an upper bound of size and complexity of ~abcl.jar~ |
|---|
| 18 | regardless of what we package in ~abcl-contrib.jar~. Having a |
|---|
| 19 | restricted core ANSI implementation plus ASDF enables us to: |
|---|
| 20 | |
|---|
| 21 | 1.1. More easily bootstrap ABCL when porting to JVM runtimes other |
|---|
| 22 | than the OpenJDK (Davlik, CLR, âŠ) |
|---|
| 23 | |
|---|
| 24 | 1.2. Subsequently use ASDF to package ABCL extension components. |
|---|
| 25 | |
|---|
| 26 | 2. Clearly mark which parts of the code-base are covered under |
|---|
| 27 | GPLv2+classpath from those that may have other licensing terms. By |
|---|
| 28 | making the loading of the "abcl-contrib" a dynamic, user-initiated, |
|---|
| 29 | operation, we maintain our license compliance. Providing, but not |
|---|
| 30 | shipping, ABCL-AIO, defers possible infringement to the User who |
|---|
| 31 | redistributes the resulting jar artifact. |
|---|
| 32 | |
|---|
| 33 | Users often want to simply package both artifacts in a single jar for |
|---|
| 34 | deployment convenience. abcl-1.5.0 introduced the build machinery to |
|---|
| 35 | create such an "all-in-one" artifact via the [[https://github.com/armedbear/abcl/blob/master/build.xml#L517][~abcl-aio.jar~]] target. |
|---|
| 36 | Upon invoking the ~abcl-aio.jar~ target |
|---|
| 37 | #+begin_src shell |
|---|
| 38 | ant -f build.xml abcl-aio.jar |
|---|
| 39 | #+end_src |
|---|
| 40 | the resulting artifact contains both the core implementation and the |
|---|
| 41 | ABCL contrib which may be run as usual via |
|---|
| 42 | #+begin_src shell |
|---|
| 43 | java -jar dist/abcl-aio.jar |
|---|
| 44 | #+end_src |
|---|
| 45 | |
|---|
| 46 | * ASDF-JAR contrib |
|---|
| 47 | |
|---|
| 48 | The ASDF-JAR contrib provides a mechanism for package ASDF systems and |
|---|
| 49 | their recursive dependencies in a jar archive. |
|---|
| 50 | |
|---|
| 51 | An example of using this to package the CL-PPCRE system from |
|---|
| 52 | Quicklisp: |
|---|
| 53 | #+begin_src lisp |
|---|
| 54 | ;; |
|---|
| 55 | (require :abcl-contrib) |
|---|
| 56 | (require :quicklisp-abcl) |
|---|
| 57 | (ql:quickload :cl-ppcre) |
|---|
| 58 | |
|---|
| 59 | (require :asdf-jar) |
|---|
| 60 | (asdf-jar:package :cl-ppcre) |
|---|
| 61 | #+end_src |
|---|
| 62 | |
|---|
| 63 | results in a jar archive at something like |
|---|
| 64 | ~#P"/var/tmp/cl-ppcre-all-2.1.1.jar"~. |
|---|
| 65 | |
|---|
| 66 | This jar archive may be loaded in a version of the implementation via |
|---|
| 67 | |
|---|
| 68 | #+begin_src lisp |
|---|
| 69 | (require :abcl-contrib) |
|---|
| 70 | (require :asdf-jar) |
|---|
| 71 | (setf *load-verbose* t) ;; so we can verify where the load is coming from |
|---|
| 72 | (asdf-jar:add-to-asdf #P"/var/tmp/cl-ppcre-all-2.1.1.jar") |
|---|
| 73 | (asdf:load-system :cl-ppcre) |
|---|
| 74 | #+end_src |
|---|
| 75 | |
|---|
| 76 | =asdf-jar= uses all items declared in the ASDF definitions so it won't |
|---|
| 77 | work well for: |
|---|
| 78 | |
|---|
| 79 | 1. An ASDF system which depends on artifacts that are not declared as |
|---|
| 80 | existing on the file-system via an explicit reference within the |
|---|
| 81 | ASDF source reference mechanism. |
|---|
| 82 | |
|---|
| 83 | 2. Libraries such as CFFI which depend on items to be have been make |
|---|
| 84 | available via an operating system packaging mechanism. |
|---|
| 85 | |
|---|
| 86 | * Implementation Status |
|---|
| 87 | |
|---|
| 88 | Ideally, we would like allow the AIO mechanism to include additional |
|---|
| 89 | ASDF systems in the single jar artifact. |
|---|
| 90 | |
|---|
| 91 | Currently one can hack this together by: |
|---|
| 92 | |
|---|
| 93 | 1. Manually extracting the ~abcl-aio.jar~ artifact to a file-system. |
|---|
| 94 | |
|---|
| 95 | 2. Placing the necessary ASDF systems in the resulting "contrib" |
|---|
| 96 | directory. |
|---|
| 97 | |
|---|
| 98 | 3. Recreating the single archive from the file-system contents. |
|---|
| 99 | |
|---|
| 100 | * TODO Future directions |
|---|
| 101 | |
|---|
| 102 | Obviously, we could provide more convenience in packaging ABCL |
|---|
| 103 | applications as single archives . Rather than mucking around in the |
|---|
| 104 | Ant build system, I would rather that we add the necessary machinery |
|---|
| 105 | =ABCL-BUILD= contrib as it will make customization much easier for |
|---|
| 106 | those who know Common Lisp. |
|---|
| 107 | |
|---|
| 108 | Patches towards easier use are gratefully solicited. |
|---|
| 109 | |
|---|
| 110 | |
|---|
| 111 | * Colophon |
|---|
| 112 | #+begin_example |
|---|
| 113 | Mark <evenson.not.org@gmail.com> |
|---|
| 114 | Created: <2019-11-25 Mon> |
|---|
| 115 | Revised: <2023-06-12 Mon 09:09> |
|---|
| 116 | #+end_example |
|---|
| 117 | |
|---|
| 118 | |
|---|
| 119 | |
|---|