Welcome to little lamb

Code » comain » master » tree

[master] / mkcmn

#!/bin/sh

d=$1
if ! test "$(expr substr "$d" 1 13)" = "build/comain/"; then
    echo "invalid destination: $d" >&2
    exit 1
fi
n="$(expr substr "$d" 14 ${#d})"

if ! test -e config.tmp/incdir; then
    echo "missing config.tmp/incdir" >&2
    exit 1
fi

test -e "$d" || mkdir -p "$d"
cp meta/version "$d"
printf %s "-l$n" > "$d/libs" # default
cp config.tmp/incdir "$d/incdir"
set libs libs.static cflags cflags.static cppflags cppflags.static ldflags ldflags.static
for ext; do
    if test -e meta/lib$n.$ext; then
        cp meta/lib$n.$ext "$d/$ext"
    fi
done

if test -d meta/deps; then
    rm -rf "$d/deps"
    mkdir "$d/deps"
    for dep in meta/deps/*; do
        test -e "$dep/cpnt" && continue
        n="$(expr substr "$dep" 11 ${#dep})"
        mkdir "$d/deps/$n"
        set version library is_found get_version get_libs get_cflags get_ldflags
        for file; do
            if test -e "$dep/$file"; then
                cp "$dep/$file" "$d/deps/$n"
            fi
        done
    done
fi