clbrewer
20231021
No Description
Upstream URL
Author
License
clbrewer  Homebrew formula builder for Common Lisp applications.
CLBREWER ASDF System Details

Description: Homebrew formula builder for Common Lisp applications.

Licence: Public Domain

Author: Dmitry Petrov dpetroff@gmail.com

Maintainer: Alexander Artemenko svetlyak.40wt@gmail.com

Homepage: https://40ants.com/clbrewer/

Bug tracker: https://github.com/40ants/clbrewer/issues

Source control: GIT

Depends on: alexandria, clplussslosxfix, commandlinearguments, deploy, ironclad, quicklisp, str, trivialdownload
About
Currently there is now easy way to distribute common lisp applications. One promising way is to use roswell project however it might be to complicated for the users how just want to install an application and are not really interested in having one more package manager for that.
In Mac OS
X world the most popular solution is to use brew package manager and all
we need is to be able to generate formula that will handle installation proccess.
Since homebrew guidelines are not really fond of using thirdparty managers to
get dependencies, we need to generate list manually and feed it to brew.
clbrewer uses SBCL
and targets command line applications written in Common Lisp.
GUI
applications haven't been tested and might require additional changes.
This application is based on the awesome quicklisphomebrewroundup but has a purpose to make a process simplier by:

Allowing to generate file for any system available not just quicklisp package (dependencies should be on quicklisp though)

Allowing to generate a complete formula, not just dependencies

Having a cli interface that can be used in
CI
services to generate formulas automatically.
At the moment several assumptions were made:

Formula is generated for the system available for
ASDF
. 
All dependencies should be available via quicklisp.

System source code should live on github all releases should be tagged with vX.Y.Z scheme.

System should have description, version, homepage fields defined. Project at GitHub should have a tag corresponding to the current system version. GitHub build a tar.gz archive with sources of the tagged revision and this way a formula, created by clbrewer, will be able to fetch sources, corresponding to the version.

Buildapp calls
main
function. By defaultmain
function is searched in the package with the same name as system name but can be overridden with option. 
When using Deploy, you don't have to define an entry point. Also, Deploy is able to create formulas for applications which build some dynamic libraries.
Here is an example formula
Installation
brew tap 40ants/soft
brew install clbrewer
Or you can install it using Roswell:
# install roswell and sbcl before
$ ros install 40ants/clbrewer
If you want to install it to use from the REPL
, then you can install this library from Quicklisp,
but you want to receive updates quickly, then install it from Ultralisp.org:
(qldist:installdist "http://dist.ultralisp.org/"
:prompt nil)
(ql:quickload :clbrewer)
Usage
Just run:
clbrewer <yoursystemname>
This will emit <yoursystemname>.rb
file in current folder.
To run clbrewer under Qlot, you'll need set SBCL_HOME
variable.
Otherwise sbsys::*sbclhomedirpathname*
variable will be reinitialized
and this can cause some incompatibilities if Qlot and clbrewer were built
with different SBCL
implementations.
Thus, in this case call clbrewer like this:
qlot exec bash c "SBCL_HOME='' clbrewer <yoursystemname>"
Building a formula for clbrewer
To kickstart a clbrewer and to create a formula for itself, load it in the REPL
and do like that:
CLUSER> (clbrewer:createformula :clbrewer)
#<BUILDAPPFORMULA "clbrewer" depends on 23 systems>
CLUSER> (clbrewer:saveformula * "clbrewer"
:preload (list "quicklispstarter"))
Downloading "https://github.com/40ants/clbrewer/archive/v0.5.5.tar.gz" (Unknown size)
NIL
However, in most cases you can just install clbrewer from the Homebrew. In this case,
you can update clbrewer's
formula with this command:
qlot exec clbrewer
preload quicklispstarter
clbrewer
Installing From Local Formula
How to install clbrewer (or any other project) from a local formula?
Replace url line in a formula:
url "https://github.com/40ants/clbrewer/archive/v0.5.6.tar.gz"
with two lines like this:
url File.dirname(__FILE__), :using => :git
version "0.5.6rc1"
Next, do this in the shell:
HOMEBREW_NO_AUTO_UPDATE=1 brew install debug verbose ./*.rb
it should build and install clbrewer
.
Contribute
If you are interested in using this project but your application has different requirements, please open an issue or make a pull request. Contributions are welcome!
License
All code is public domain except parts that were taken from quicklisphomebrewroundup which is under MIT
License.
API
CLBREWER
package clbrewer
Classes
FORMULA
class clbrewer:formula
()
Base class for Homebrew formula definition.
Readers
reader clbrewer/formula:includedsystems
(formula) (:includedsystems)
reader clbrewer/formula:missingsystems
(formula) (:missingsystems)
reader clbrewer/formula:rootsystem
(formula) (:rootsystem)
Accessors
accessor clbrewer/formula:includedsystems
(formula) (:includedsystems)
accessor clbrewer/formula:missingsystems
(formula) (:missingsystems)
accessor clbrewer/formula:rootsystem
(formula) (:rootsystem)
Generics
genericfunction clbrewer:createformula
system
Create
genericfunction clbrewer:getimplicitdependencies
systemname
Some systems, like clunicode have implicit dependencies in their asdf methods: https://github.com/edicl/clunicode/blob/8073fc5634c9d4802888ac03abf11dfe383e16fa/clunicode.asd#L67L70 use this method to provide information about such dependencies.
System name is a keyword and method should return a one keyword or a list of keywords with names of systems. Each returned system should be possible to find with qldist:findsystem.
Functions
function clbrewer:saveformula
formula name &key entrypoint preload
Saves Homebrew formula definition into the file with given NAME
.
If ENTRYPOINT
argument was given, then it might be used as entrypoint,
but some formula classes like clbrewer/deploy/formula:deployformula
might ignore this argument.
PRELOAD
argument if given, should be a list of strings with
ASDF
system names to be preloaded before clbrewer will build a binary.
CLBREWER/BUILDAPP/FORMULA
package clbrewer/buildapp/formula
Classes
BUILDAPPFORMULA
class clbrewer/buildapp/formula:buildappformula
(formula)
This formula class uses Buildapp to build a binary.
CLBREWER/DEPLOY/FORMULA
package clbrewer/deploy/formula
Classes
DEPLOYFORMULA
class clbrewer/deploy/formula:deployformula
(formula)
This formula class uses Deploy to build a binary.
The core difference from clbrewer/buildapp/formula:buildappformula
is that
this type of formula also builds and distributes all necessary dynamic libraries.
CLBREWER/FORMULA
package clbrewer/formula
Generics
genericfunction clbrewer/formula:getadditionaldependencies
formula
Some formulas might add dependencies needed to build a binary. For example, Deploy formula adds clbrewer because it uses it's clbrewer/deploy/hooks subsystem.
[genericfunction] clbrewer/formula:includedsystems
object
[genericfunction] clbrewer/formula:missingsystems
object
[genericfunction] clbrewer/formula:rootsystem
object
Macros
macro clbrewer/formula:definequesser
name (asdfsystem) &body body
Use this macro to define a function to guess a formula class.
The function should accept a one argument  an ASDF
system and
return a symbol denoting a class derived from formula
class.
If guesser does not know how to create a formula for the system,
then it should return a NIL
value.