-
Notifications
You must be signed in to change notification settings - Fork 1
Package
To create a package named Foo, you make a directory of the following structure.
- Foo
- src
- Spec.sml
The file Spec.sml contains a specification of the package. It at least includes its name, version and library dependencies. When under the root Foo directory, a mi build command should download external dependencies to the lib directory (it will be created if not existed).
A minimal example of Spec.sml is shown below.
structure Spec =
struct
val name = "test"
val version = "0.1"
local
val concatLines = String.concatWith "\n"
in
val description =
concatLines
[
"Just a test library",
"Another line of description"
]
end
val dependencies =
[
("json", "git://github.com/mi-lang/json")
]
endDuring build, each external dependencies is downloaded to a subdirectory of lib, then built recursively with binary objects and executables saved to bin dir. After building, the package file hierarchy looks like below.
- Foo
|- src
|- lib
|- Bar
|- src
|- lib
|- bin
|- List.o (object file)
|- List.mli (intermediate file)
- Spec.sml
|- bin
|- Bar (link to ../lib/Bar/bin)
|- foo (executable file)
|- Spec.sml
Each dependency library is built separately from the root package and other libraries, so that packages could coexist even if they have different versions of the same dependency. In addition, a dependency's output is linked from bin dir of the dependent, so that it's in correct namespace.