⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chicken-setup.html

📁 Scheme跨平台编译器
💻 HTML
📖 第 1 页 / 共 3 页
字号:
(<B><FONT COLOR="#A020F0">define</FONT></B> <B><FONT COLOR="#0000FF">glass-lambda-accessor</FONT></B> procedure-data)(<B><FONT COLOR="#A020F0">define</FONT></B> (<B><FONT COLOR="#0000FF">glass-lambda-ref</FONT></B> gl v) ((procedure-data gl) v))(<B><FONT COLOR="#A020F0">define</FONT></B> (<B><FONT COLOR="#0000FF">glass-lambda-set!</FONT></B> gl v x) ((procedure-data gl) v x))</PRE><p>The setup script looks like this:</p><PRE>(compile -s glass-support.scm)(install-extension  'glass  '(<B><FONT COLOR="#BC8F8F">&quot;glass.scm&quot;</FONT></B> <B><FONT COLOR="#BC8F8F">&quot;glass-support.so&quot;</FONT></B>)  '((syntax) (require-at-runtime glass-support)) )</PRE><p>The invocation of <tt>install-extension</tt> provides the files that are to be copied into the extension repository, and a metadata list that specifies that the extension <tt>glass</tt> is a syntax extension and that, if it is declared to be used by other code (either with the <tt>require-extension</tt> or <tt>require-for-syntax</tt> form), then client code should perform an implicit <tt>(require 'glass-support)</tt> at startup.</p><p>This can be conveniently packaged as an <em>egg</em>:</p><pre>$ tar cfz glass.egg glass.setup glass.scm glass-support.scm</pre><p>And now we use it:</p><pre>$ chicken-setup glass$ csi -quiet#;1&gt; (require-extension glass); loading /usr/local/lib/chicken/1/glass.scm ...; loading /usr/local/lib/chicken/1/glass-support.so ...#;2&gt; (define foo (glass-lambda (x) (y) (+ x y)))#;3&gt; (glass-lambda-set! foo 'y 99)#;4&gt; (foo 33)132</pre><a name="chicken-setup-reference"></a><h2>chicken-setup reference</h2><p>Available options:</p><dl><dt><tt>-h  -help</tt></dt><dd>Show usage information and exit.</dd><dt><tt>-V  -version</tt></dt><dd>Display version and exit.</dd><dt><tt>-R  -repository [PATHNAME]</tt></dt><dd>When used without an argument, the path of the extension repository is displayed on standard output. When given an argument, the repository pathname (and the <tt>repository-path</tt> parameter) will be set to <tt>PATHNAME</tt> for all subsequent operations. The default repository path is the installation library directory (usually <tt>/usr/local/lib/chicken</tt>), or (if set) the directory given in the environment variable <tt>CHICKEN_REPOSITORY</tt>. <tt>PATHNAME</tt> should be an absolute pathname.</dd><dt><tt>-P  -program-path [PATHNAME]</tt></dt><dd>When used without an argument, the path for executables is displayed on standard output. When given an argument, the program path for installing executables and scripts will be set to <tt>PATHNAME</tt> for all subsequent operations. <tt>PATHNAME</tt> should be an absolute pathname.</dd><dt><tt>-h  -host HOSTNAME[:PORT]</tt></dt><dd>Specifies alternative host for downloading extensions, optionally with a TCP port number (which defaults to 80).</dd><dt><tt>-u  -uninstall EXTENSION</tt></dt><dd>Removes all files that were installed for <tt>EXTENSION</tt> from the file-system, together with any metadata that has been stored.</dd><dt><tt>-l  -list [NAME ...]</tt></dt><dd>List all installed extensions or show extension information.</dd><dt><tt>-r  -run FILENAME</tt></dt><dd>Load and execute given file.</dd><dt><tt>-s  -script FILENAME</tt></dt><dd>Executes the given Scheme source file with all remaining arguments and exit. The <em>she-bang</em> shell script header is recognized, so you can write Scheme scripts that use <tt>chicken-setup</tt> just as with <tt>csi</tt>.</dd><dt><tt>-e  -eval EXPRESSION</tt></dt><dd>Evaluates the given expression(s)</dd><dt><tt>-v  -verbose</tt></dt><dd>Display additional debug information</dd><dt><tt>-k  -keep</tt></dt><dd>Keep temporary files and directories</dd><dt><tt>-c  -csc-option OPTION</tt></dt><dd>Passes <tt>OPTION</tt> as an extra argument to invocations of the compiler-driver (<tt>csc</tt>); this works only if <tt>csc</tt> is invoked as <tt>(run (csc ...))</tt></dd><dt><tt>-d  -dont-ask</tt></dt><dd>Do not ask the user before trying to download required extensions</dd><dt><tt>-n  -no-install</tt></dt><dd>Do not install generated binaries and/or support files; any invocations of <tt>install-program</tt>, <tt>install-extension</tt> or <tt>install-script</tt> will be be no-ops</dd><dt><tt>-i  -docindex</tt></dt><dd>Displays the path to the index-page of any installed extension-documentation; if the index page does not exist, it is created</dd><dt><tt>-t  -test EXTENSION ...</tt></dt><dd>return success if all given extensions are installed</dd><dt><tt>-ls EXTENSION</tt></dt><dd>List installed files for extension</dd><dt><tt>-fetch-tree</tt></dt><dd>Download and print the repository catalog</dd><dt><tt>-create-tree DIRECTORY</tt></dt><dd>Create a fresh, minimal repository catalog and writes it to stdout</dd><dt><tt>-t  -test</tt></dt><dd>If the extension sources contain a directory named <tt>tests</tt> and this directory includes a file named <tt>run.scm</tt> then this file is executed (with <tt>tests</tt> being the current working directory)</dd><dt><tt>-tree FILENAME</tt></dt><dd>Download and show the repository catalog</dd><dt><tt>-svn URL</tt></dt><dd>Fetch extension from <a href="http://subversion.tigris.org" class="external">Subversion</a> repository</dd><dt><tt>-svn-trunk URL</tt></dt><dd>Fetch extension from trunk in <a href="http://subversion.tigris.org" class="external">Subversion</a> repository</dd><dt><tt>-revision REV</tt></dt><dd>Specifies SVN revision to check out</dd><dt><tt>-local PATHNAME</tt></dt><dd>Fetch extension from local file</dd><dt><tt>-install-prefix PATHNAME</tt></dt><dd>Specify alternative installation prefix (for packaging)</dd><dt><tt>-host-extension</tt></dt><dd>Compile extension in "host" mode (sets the parameter <tt>host-extension</tt> to <tt>#f</tt>)</dd><dt><tt>-build-prefix PATHNAME</tt></dt><dd>Location where chicken-setup will create egg build directories  (default: the value of environment variable CHICKEN_TMPDIR, or <tt>/tmp/chicken-{MAJOR-VERSION-build-{USER</tt>}})</dd><dt><tt>-download-path PATHNAME</tt></dt><dd>Location where chicken-setup will save downloaded files  (default: <tt>build-prefix/downloads</tt>)</dd><dt><tt>--</tt></dt><dd>Ignore all following arguments</dd></dl><p>Note that the options are processed exactly in the order in which they appear in the command-line.</p><a name="windows-notes"></a><h2>Windows notes</h2><p><tt>chicken-setup</tt> works on Windows, when compiled with Visual C++, but depends on the <tt>tar</tt> and <tt>gunzip</tt> tools to extract the contents of an egg. The best way is to download an egg either manually (or with <tt>chicken-setup -fetch</tt>) and extract its contents with a separate program (like <tt>winzip</tt>). the <tt>CHICKEN_REPOSITORY</tt> environment variable has to be set to a directory where your compiled extensions should be located.</p><p>The <tt>.setup</tt> scripts will not always work under Windows, and the extensions may require libraries that are not provided for Windows or work differently. Under these circumstances it is recommended to perform the required steps to build an extension manually.</p><p>The required UNIX tools are also available as Windows binaries. Google or ask on the CHICKEN mailing list if you need help locating them.</p><a name="security"></a><h2>Security</h2><p>When extensions are downloaded and installed one is executing code from potentially compromised systems. This applies also when <tt>chicken-setup</tt> executes system tests for required extensions. As the code has been  retrieved over the network effectively untrusted code is going to be evaluated. When <tt>chicken-setup</tt> is run as <em>root</em> the whole system is at the mercy of the build instructions (note that this is also the case every time you install software via <tt>sudo make install</tt>, so this is not specific to the CHICKEN extension mechanism).</p><p>Security-conscious users should never run <tt>chicken-setup</tt> as root. A simple remedy is to set the environment variable <tt>CHICKEN_REPOSITORY</tt>, which will transparently place the repository at an arbitrary user-selected location. Alternatively obtain write/execute access to the default location of the repository (usually <tt>/usr/local/lib/chicken</tt>) to avoid running as root.</p><a name="other-modes-of-installation"></a><h2>Other modes of installation</h2><p>It is possible to install extensions directly from a <a href="http://subversion.tigris.org" class="external">Subversion</a> repository or from a local checkout by using the <tt>-svn</tt> or <tt>-local</tt> options. By using either the <tt>svn</tt> client program (which must be installed) or file-system operations, all necessary files will be copied into the current directory (creating a subdirectory named <tt>EXTENSIONNAME.egg-dir</tt>), built and subsequently installed.</p><p>Dependency information, which is necessary to ensure required extensions are also installed, is downloaded automatically.  If you have no internet connection or don't want to connect, you can also use a local file containing the necessary dependency information.  The <tt>-fetch-tree</tt> option retrieves the canonical <em>repository file</em> at <a href="http://www.call-with-current-continuation.org/eggs/repository" class="external">http://www.call-with-current-continuation.org/eggs/repository</a>, writing it to stdout. Redirecting this output into a file and passing the file via the <tt>-tree</tt> option to <tt>chicken-setup</tt> allows you now to use the local repository file:</p><p>Retrieve complete extension repository (big):</p><pre>% cd /opt% svn co <a href="https://galinha.ucpel.tche.br/svn/chicken-eggs/release/3" class="external">https://galinha.ucpel.tche.br/svn/chicken-eggs/release/3</a> eggs</pre><p>Get your own copy of the repository file:</p><pre>% chicken-setup -fetch-tree &gt;~/my-repository-file</pre><p>Now you can install eggs from your local checkout, with full dependency tracking and without being connected to the internet:</p><pre>% cd ~/tmp% chicken-setup -local /opt/eggs -tree ~/my-repository-file opengl</pre><a name="linking-extensions-statically"></a><h2>Linking extensions statically</h2><p>The compiler and <a href="chicken-setup.html" class="internal">chicken-setup</a> support statically linked  eggs. The general approach is to generate an object file or static library (in addition to the usual shared library) in your <tt>.setup</tt> script and install it along with the dynamically loadable extension. The setup properties <tt>static</tt>  should contain the name of the object file (or static library) to be linked, when <tt>csc</tt> gets passed the <tt>-static-extensions</tt> option:</p><PRE>(compile -s -O2 -d1 my-ext.scm)   <I><FONT COLOR="#B22222">; dynamically loadable &quot;normal&quot; version</FONT></I>(compile -c -O2 -d1 my-ext -unit my-ext)  <I><FONT COLOR="#B22222">; statically linkable version</FONT></I>(install-extension  'my-ext  '(<B><FONT COLOR="#BC8F8F">&quot;my-ext.so&quot;</FONT></B> <B><FONT COLOR="#BC8F8F">&quot;my-ext.o&quot;</FONT></B>)  '((static <B><FONT COLOR="#BC8F8F">&quot;my-ext.o&quot;</FONT></B>)) )</PRE><p>Note the use of the <tt>-unit</tt> option in the second compilation step: static linking must use static library units. <tt>chicken-setup</tt> will perform  platform-dependent file-extension translation for the file list, but does currently not do that for the <tt>static</tt> extension property.</p><p>To actually link with the static version of <tt>my-ext</tt>, do:</p><pre>% csc -static-extensions my-program.scm -uses my-ext</pre><p>The compiler will try to do the right thing, but can not handle all extensions, since the ability to statically link eggs is relatively new. Eggs that support static linking are designated as being able to do so. If you require a statically linkable version of an egg that has not been converted yet, contact the extension author or the CHICKEN  mailing list.</p><p>Previous: <a href="interface-to-external-functions-and-variables.html" class="internal">Interface to external functions and variables</a></p><p>Next: <a href="data-representation.html" class="internal">Data representation</a></p></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -