Source

sulu-ocaml-core / bin / make-dist

Full commit
ysulsky 34c4f8a 


ysulsky 77d8544 

ysulsky 34c4f8a 









ysulsky 915dde7 
ysulsky 34c4f8a 
ysulsky 915dde7 
ysulsky 34c4f8a 
















ysulsky 77d8544 
ysulsky 675916d 
ysulsky 915dde7 


ysulsky 34c4f8a 



ysulsky 675916d 
ysulsky 915dde7 
ysulsky 675916d 

ysulsky 34c4f8a 







ysulsky 915dde7 
ysulsky 34c4f8a 


ysulsky 675916d 
ysulsky 915dde7 









ysulsky 675916d 

ysulsky 77d8544 
ysulsky 675916d 
ysulsky 915dde7 





























#!/usr/bin/env bash
set -e -u -o pipefail

source $(dirname -- "$0")/../build-common.sh
root=$(cd "$HERE"; hg root)

function usage {
    echo "usage: ${BASH_SOURCE[0]} <dest-dir> [packages...]"
}

if [[ $# -lt 1 ]]; then usage; exit 1; fi

destdir="$1"
shift
if [[ $# -gt 0 ]]; then
    dirs="$@"
else
    dirs="${build_order[@]}"
fi

function file_included {
    case "$1" in
        oasis.sh)             false;;
        _build)               false;;
        setup.log|setup.data) false;;
        *) [[ ! -e "$1"/oasis.sh ]];;
    esac
}
excluded=(
    oasis.sh
    _build
    setup.log
    setup.data
)

cp "$root/build-and-install" "$destdir/"

packages=( )
for dir in $dirs; do
    pushd "$root/$dir"

    ./oasis.sh
    name=$(oasis query name)
    version=$(oasis query version)

    packages+=( "${name}-${version}" )
    echo "    $name-$version" >>"$destdir/build-common.sh"

    dest="$destdir/${name}-${version}"
    mkdir "$dest"

    for f in *; do
        if file_included "$f"; then
            cp -rp "$f" "$dest/$f"
        fi
    done
    cp -p "$root"/licensing/* "$dest/"

    popd
done

cat >"$destdir/build-common.sh" <<EOF
#!/bin/bash

core_version=$core_version

# in dependency-topological order
build_order=(
$(for pkg in "${packages[@]}"; do
    echo "    $pkg"
  done)
)

HERE=\$(cd "$(dirname -- "\$0")"; pwd);
EOF

cat >"$destdir/README" <<EOF
This package contains the following libraries from
https://bitbucket.org/yminsky/ocaml-core/:

$(for pkg in "${packages[@]}"; do
    echo "* $pkg"
  done)

Dependencies
============

In order to compile this package, you will need:
* ocaml      (>= 3.12)
* findlib    (>= 1.2.7)
* pcre-ocaml (http://www.ocaml.info/home/ocaml_sources.html#pcre-ocaml)
* res        (http://www.ocaml.info/home/ocaml_sources.html#res)
* oUnit      (http://forge.ocamlcore.org/projects/ounit)

Installing
==========

1. Go to the root of the package
2. Run ./build-and-install -s

Uninstalling
============

1. Go to the root of the package
2. Run ./build-and-install -u -s
EOF