Changeset 38841 in project


Ignore:
Timestamp:
08/14/20 15:41:30 (4 months ago)
Author:
Mario Domenech Goulart
Message:

/eggs tutorial: make the eggs tutorial specific to C5, for simplicity

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggs tutorial

    r37995 r38841  
    5252CHICKEN 5 introduced an new format for the system to build eggs, which
    5353is incompatible with the one for CHICKEN 4.  Below you can find
    54 information about both.
    55 
    56 
    57 ==== For CHICKEN 5
     54information on CHICKEN 5.  For information on CHICKEN 4, see
     55[[/eggs-tutorial-4|Eggs tutorial for CHICKEN 4]].
    5856
    5957The build system for eggs in CHICKEN 5 reads {{.egg}} files, which
     
    7068
    7169
    72 ==== For CHICKEN 4
    73 
    74 CHICKEN 4 uses two separate files for the build system: a {{.setup}}
    75 with instructions on how to build the egg; and a {{.meta}} file
    76 containing metadata on the egg (license, dependencies, synopsis,
    77 author etc.).
    78 
    79 Below is an example of an extension is called ''mpeg3''.  Replace
    80 occurences of that string throughout this file with the actual name of
    81 your extension.
    82 
    83 
    84 ===== The setup file
    85 
    86 In order for {{chicken-install}} to install your extension, we recommend that you create a {{mpeg3.setup}} file with information about your egg.
    87 {{chicken-install}} will load this file. {{chicken-install}} adds some new procedures to the environment, which are documented in [[/man/4/Extensions#procedures-and-macros-available-in-setup-scripts|the "Extensions" section of the manual]].
    88 
    89 If your egg does not contain macros, your setup file should look similar to the following:
    90 
    91 <enscript highlight=scheme>
    92 ;; These two instructions will produce statically and dynamically linkable object files "mpeg3.o" and "mpeg3.so" respectively.
    93 (compile -s -O3 -d1 mpeg3.scm -j mpeg3)
    94 (compile -s mpeg.import.scm -O3 -d0)
    95 
    96 (install-extension
    97  ;; Name of your extension:
    98  'mpeg3
    99  ;; Files to install for your extension:
    100  '("mpeg3.so" "mpeg3.import.so")
    101  ;; Assoc list with properties for your extension:
    102  '((version "1.2")))
    103 </enscript>
    104 
    105 The first line will cause {{mpeg3.scm}} to be compiled into
    106 {{mpeg3.so}} (a shared library for dynamic loading), which is installed by {{install-extension}}.
    107 The {{-j}} option will make sure that an ''import library'' is generated for your module(s) which, after compilation,
    108 provide module meta-information and exported syntax. Alternatively you can use {{-J}} without any arguments to generate import libraries for all defined modules.
    109 
    110 The second line will compile the generated import library.
    111 
    112 If your egg requires your code to be linked against a specific library or certain flags (eg. {{-l}}) to be passed to the C compiler, you should specify them here.
    113 
    114 Note that version is represented by a string.  That's because numbers can be tricky to represent versions.  Integers are usually not enough to represent minor/major changes, and floating point numbers require you to determine the number of minor releases a priori, otherwise you'll inevitably end up with version 1.10, which is numerically equivalent to 1.1, and that would cause problems when chicken-install tries to match versions to determine dependencies.
    115 
    116 ===== The meta file
    117 
    118 Finally, you will need to create {{mpeg3.meta}}, with information about your egg.
    119 This file is used by the process that releases and uploads new eggs.
    120 It should contain a single s-expr as follows:
    121 
    122 <enscript highlight=scheme>(
    123 ; Your egg's license:
    124 (license "BSD")
    125 
    126 ; Pick one from the list of categories (see below) for your egg and enter it
    127 ; here.
    128 (category web)
    129 
    130 ; A list of eggs mpeg3 depends on.  If none, you can omit this declaration
    131 ; altogether. `depends' is an alias to `needs'.
    132 ; Notice that you should NOT put CHICKEN units (e.g., srfi-1, srfi-13
    133 ; and many others) in `needs' or in `depends'.
    134 (needs sandbox syntax-case)
    135 
    136 ; A list of eggs required for TESTING ONLY.  See the `Tests' section.
    137 ; Just like `needs' and `depends', `test-depends' should NOT contain
    138 ; CHICKEN units.
    139 (test-depends test)
    140 
    141 (author "Your Name Goes Here")
    142 (synopsis "A basic description of the purpose of the egg."))
    143 </enscript>
    144 
    145 More information about extension meta properties can be found here at
    146 the [[Metafile reference]].
    147 
    148 
    14970==== Egg categories
    15071
    151 For the category entry, used by for {{.meta}} and {{.egg}} files
    152 (CHICKEN 4 and 5, respectively) you can use any of the following
    153 possibilities:
     72For the category entry, used by {{.egg}} files you can use any of the
     73following possibilities:
    15474
    15575;code-generation: Code generation
     
    219139See the [[/egg/salmonella|salmonella documentation]] for more information on how to test eggs.
    220140
    221 If your egg installs an executable file and tests call that file, take a look at [[http://wiki.call-cc.org/eggref/4/salmonella#testing-executable-files-installed-by-eggs|this caveat]].
     141If your egg installs an executable file and tests call that file, take a look at [[http://wiki.call-cc.org/eggref/5/salmonella#testing-executable-files-installed-by-eggs|this caveat]].
    222142
    223143== Managing and hosting eggs
Note: See TracChangeset for help on using the changeset viewer.