Unlike legacy backends, a module backend is simply a Scheme module.
In order lepton-netlist
to understand a file is a module backend, it must
meet the following requirements:
For example, the name of your backend is my-backend.scm. In the code, you have to add module definition as follows:
(define-module (backend my-backend) #:export (my-backend))
The exported function has take no arguments. What it outputs to the
standard output port is redirected by lepton-netlist
to the specified
output file or standard output, or to the default output name if no
output file name is specified.
The function may be defined as follows:
(define (my-backend) (some-code-follows) ...)
To make the function take an arbitrary list of arguments, it can be defined as follows:
(define (my-backend . args) (some-code-that-use-args args) ...)
So, if you want the backend to be available system-wide, put it in the
scheme/backend subdirectory of one of the directories reported
by the function sys-data-dirs
,
e.g. /usr/share/lepton-eda. To find out the paths, you can use
lepton-shell
. For example:
$ lepton-shell -c '(use-modules (lepton os)) (display (sys-data-dirs))' (/usr/local/share/lepton-eda /usr/share/lepton-eda) $ sudo cp my-backend.scm /usr/local/share/lepton-eda/scheme/backend
If you want the backend to be available only for you, e.g. when you’re
just developing it, put it into the scheme/backend/
subdirectory of your Lepton user data directory which can be found
using the function user-data-dir
, typically
~/.local/share/lepton-eda. For example:
$ lepton-shell -c '(use-modules (lepton os)) (display (user-data-dir))' /home/vzh/.local/share/lepton-eda $ cp my-backend.scm /home/vzh/.local/share/lepton-eda/scheme/backend