Newer
Older

Jeremy Soller
committed
#!/bin/bash
export CFLAGS="-fno-stack-protector -U_FORTIFY_SOURCE"
function op {
echo "$1" "$2"
case "$2" in
fetch)
if [ ! -d build ]
then
git clone --recursive "$GIT" build
fi
pushd build > /dev/null
git pull
git submodule sync
git submodule update --init --recursive
popd > /dev/null
;;
unfetch)
;;
update)
pushd build > /dev/null
xargo update
popd > /dev/null
;;
build)
pushd build > /dev/null
cp -r "$ROOT/Xargo.toml" "$ROOT/libc-artifacts" .
xargo build --target "$TARGET" --release $CARGOFLAGS
popd > /dev/null
;;
clean)
pushd build > /dev/null
xargo clean
popd > /dev/null
;;
stage)
if [ "$(type -t recipe_stage)" = "function" ]
then
recipe_stage ../stage
fi
bins="$(find target/x86_64-unknown-redox/release/ -maxdepth 1 -type f ! -name '*.*')"
if [ -n "$bins" ]
then
mkdir -p ../stage/bin
for bin in $bins
do
cp -v "$bin" "../stage/bin/$(basename $bin)"
strip -v "../stage/bin/$(basename $bin)"
done
fi
rm -rfv stage.tar
;;
publish)
mkdir -p "$REPO"
cp -v stage.tar "$REPO/$1.tar"
;;
unpublish)
rm -rfv "$REPO/$1.tar"
echo "cook.sh $1 {build|clean|fetch|unfetch|publish|unpublish|stage|unstage|tar|untar|update}"
if [ -n "$1" ]
then
if [ -d "recipes/$1" ]
then
echo "cook.sh {package} {build|clean|fetch|unfetch|publish|unpublish|stage|unstage|tar|untar|update}"