source: project/wiki/eggref/4/autocompile @ 23946

Last change on this file since 23946 was 23946, checked in by felix winkelmann, 10 years ago

updated some egg wiki pages

File size: 4.1 KB
Line 
1[[tags: egg]]
2[[toc:]]
3
4== autocompile
5
6=== Introduction
7
8This extension provides a simple method of writing scripts that
9are compiled on demand. A program named {{chicken-scheme}} takes
10a Scheme file and a number of arguments and if the script has
11not been compiled before or has changed as compared to the last compiled
12version, compiles it, storing the result in a cache in the user's
13{{$HOME}} directory.
14
15
16=== Requirements
17
18[[/eggref/4/matchable|matchable]]
19
20
21=== Usage
22
23Autocompiled scripts should begin like this:
24
25  #!/usr/bin/env chicken-scheme
26 
27  ... code follows here ...
28
29{{chicken-scheme}} takes the MD5 hash of the source file and looks
30it up in the {{$HOME/.chicken-scheme.cache}} directory. If it is
31found, the cached entry is invoked with the remaingin script
32arguments. Otherwise it will be compiled, with compiler output
33redirected to a temporary file and executed after that.
34
35The {{chicken-scheme}} program accepts a few additional options:
36
37  chicken-scheme -list
38
39Lists the contents of the cache directory
40
41  chicken-scheme -purge
42
43Deletes all files in the cache directory. Compiled programs will
44be collected it here and should be periodically purged. This doesn't
45change the behaviour of existing scripts, they simply have to be
46recompiled, which should happen on first use.
47
48Invoking {{chicken-scheme}} with no arguments will simply start
49{{csi(1)}}, the CHICKEN interpreter.
50
51This extension needs the {{md5sum(1)}} program (or {{md5(1)}} on Mac OS X).
52
53
54=== Environment variables
55
56A few environment variables allow customization of the autocompilation
57mechanism:
58
59  HOME
60
61Your home directory that will contain the cache (the latter is created
62automatically, if it doesn't exist).
63
64  CHICKEN_SCHEME_DEBUG
65
66If set, show progress information during the compilation.
67
68  CHICKEN_SCHEME_OPTIONS
69
70Options passed to {{csc(1)}}. The default options are {{-O2}}.
71
72  CHICKEN_SCHEME_HOOK
73
74The name of a program to be invoked when compiling a script. When
75a program must be compiled, the hook is invoked as a shell command:
76
77  $CHICKEN_SCHEME_HOOK start SOURCEFILE ERRORFILE
78
79{{ERRORFILE}} will receive compiler output and error-messages.
80
81After the compilation, the hook is called as
82
83  $CHICKEN_SCHEME_HOOK end SOURCEFILE ERRORFILE
84
85When the compilation fails, the hook is invoked as
86
87  $CHICKEN_SCHEME_HOOK fail SOURCEFILE ERRORFILE
88
89
90=== License
91
92 Copyright (c) 2009-2011, Felix L. Winkelmann
93 
94 All rights reserved.
95 
96 Redistribution and use in source and binary forms, with or without
97 modification, are permitted provided that the following conditions
98 are met:
99 
100  Redistributions of source code must retain the above copyright
101    notice, this list of conditions and the following disclaimer.
102  Redistributions in binary form must reproduce the above copyright
103    notice, this list of conditions and the following disclaimer in the
104    documentation and/or other materials provided with the distribution.
105  Neither the name of the author nor the names of its contributors
106    may be used to endorse or promote products derived from this
107    software without specific prior written permission.
108 
109 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
110 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
111 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
112 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
113 HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
114 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
115 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
116 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
117 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
118 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
119 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
120
121
122=== Version history
123
124; 0.9 : fixed NetBSD-specific option to {{md5}} [thanks to Peter Bex]
125; 0.7 : added regex dependency
126; 0.6 : uses {{md5(3)}} program on NetBSD/FreeBSD/OpenBSD/Dragonfly
127; 0.5 : added missing import
128; 0.2 : fixed stupid typo in setup script; hacked around problem with srfi-13 syntax reexport
129; 0.1 : initial release
Note: See TracBrowser for help on using the repository browser.