chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] How to bootstrap developing a CHICKEN application?


From: Mario Domenech Goulart
Subject: Re: [Chicken-users] How to bootstrap developing a CHICKEN application?
Date: Sun, 01 Feb 2015 12:29:58 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Hi Bahman,

On Sun, 01 Feb 2015 03:57:40 +0330 Bahman Movaqar <address@hidden> wrote:

> A naive question but suppose I want to write an application (not an
> egg); an application in the sense that it will not be installed in
> CHICKEN repository.
> What is the recommended directory structure? How can I run the tests
> (like 'chicken-install -test')? How can I express dependencies? Or is it
> just *my* conception of application and in CHICKEN there is no
> difference between this and an egg?

It's totally up to your preferences.  Technically, it can be structured
as an egg, and that's probably the most convenient way.

.setup files can contain arbritrary CHICKEN code.  You don't even need
to use setup-api stuff (e.g., install-extension, install-program,
compile etc).  So, you can use a .setup file to build your application
only.  It doesn't automatically install it, unless you use something
like `install-extension'.  You can even have a regular Makefile and just
put `(system "make")' into your .setup file (or you can use the make
egg).

.meta files can be used to specify dependencies.  It can also contain
arbitrary _data_ that your application may use.  chicken-install won't
bother if you put there things that it doesn't know.

I'd recommend a flat directory layout for the source code.  CHICKEN is
quite limited with regard to search paths, so if you have dependencies
among your application's modules, you'll probably want a flat directory
layout (I mean all source files under the same directory).  You can,
however, use a subdirectory for Scheme source.  Example:

app
├── app.meta
├── app.setup
├── COPYING
├── locale
│   └── en_US
├── README
├── src
│   ├── bar.scm
│   ├── baz.scm
│   └── foo.scm
└── tests
    └── run.scm

In this case, you can use something like (change-directory "src") in
your .setup file and build your app normally.  That's not very usual for
eggs, but I sometimes use this approach not to clutter the app source
root directory much (e.g., https://github.com/mario-goulart/awful-picman).

For tests, if you want to run "chicken-install -test" (or salmonella),
you'll have to follow chicken-install's convention: a "tests" directory
which contains a "run.scm" script.  run.scm is just the entry point for
the tests.  It can include files, load files and run arbitrary code.
Again, it's up to you to decide how to organize tests.

The nice thing about structuring your application as an egg is that you
get some interesting things for free.  For example, cross-compilation
support and the availability of egg-related tools (e.g., salmonella).

Best wishes.
Mario
-- 
http://parenteses.org/mario



reply via email to

[Prev in Thread] Current Thread [Next in Thread]