Skip to content
Snippets Groups Projects
Commit dc0f56c2 authored by Iori Yoneji's avatar Iori Yoneji
Browse files

Merge branch 'master' into allow_build_on_freebsd

parents 08c8b2fb b91b2762
Branches
Tags
1 merge request!12Allow build on FreeBSD
#!/usr/bin/env bash -e
# Configuration
export TARGET=x86_64-unknown-redox
# Automatic variables
ROOT="$(cd `dirname "$0"` && pwd)"
REPO="$ROOT/repo/$TARGET"
export CC="$ROOT/libc-artifacts/gcc.sh"
#!/usr/bin/env bash
#!/usr/bin/env bash -e
# Configuration
export TARGET=x86_64-unknown-redox
# Automatic variables
ROOT="$(cd `dirname "$0"` && pwd)"
REPO="$ROOT/repo/$TARGET"
export CC="$ROOT/libc-artifacts/gcc.sh"
source config.sh
# Variables to be overriden by recipes
export BINDIR=bin
export CARGOFLAGS=
set -e
function usage {
echo "cook.sh $1 <op>" >&2
echo " dist" >&2
......@@ -22,6 +14,8 @@ function usage {
echo " clean" >&2
echo " fetch" >&2
echo " unfetch" >&2
echo " prepare" >&2
echo " unprepare" >&2
echo " publish" >&2
echo " unpublish" >&2
echo " stage" >&2
......@@ -40,7 +34,7 @@ function op {
case "$2" in
dist)
op $1 fetch
op $1 prepare
op $1 update
op $1 build
op $1 stage
......@@ -49,7 +43,7 @@ function op {
distclean)
op $1 untar
op $1 unstage
op $1 unfetch
op $1 unprepare
;;
fetch)
if [ -n "$TAR" ]
......@@ -64,9 +58,6 @@ function op {
mkdir source
tar xvf source.tar -C source --strip-components 1
fi
rm -rf build
cp -r source build
elif [ -n "$GIT" ]
then
if [ ! -d source ]
......@@ -79,19 +70,22 @@ function op {
git submodule sync
git submodule update --init --recursive
popd > /dev/null
rm -rf build
cp -r source build
fi
;;
unfetch)
rm -rfv build source
rm -rfv source
if [ -n "$TAR" ]
then
rm -f source.tar
fi
;;
prepare)
rm -rf build
cp -r source build
;;
unprepare)
rm -rf build
;;
version)
pushd build > /dev/null
skip="0"
......@@ -135,7 +129,7 @@ function op {
fi
if [ "$skip" -eq "0" ]
then
cp -r "$ROOT/Xargo.toml" "$ROOT/.cargo" "$ROOT/libc-artifacts" .
cp -r "$ROOT/Xargo.toml" .
xargo build --target "$TARGET" --release $CARGOFLAGS
fi
popd > /dev/null
......@@ -149,7 +143,7 @@ function op {
fi
if [ "$skip" -eq "0" ]
then
cp -r "$ROOT/Xargo.toml" "$ROOT/.cargo" "$ROOT/libc-artifacts" .
cp -r "$ROOT/Xargo.toml" .
xargo test --no-run --target "$TARGET" --release $CARGOFLAGS
fi
popd > /dev/null
......@@ -222,24 +216,7 @@ function op {
if [ -n "$1" ]
then
if [ "$1" = "repo" ]
then
if [ ! "$COOK_QUIET" = "1" ]
then
echo -e "\033[01;38;5;215mcook - repo\033[0m" >&2
fi
echo "[packages]" > "$REPO/repo.toml"
for toml in "$REPO/"*".toml"
do
package="$(basename "$toml" .toml)"
if [ "$package" != "repo" ]
then
version="$(grep version "$toml" | cut -d '=' -f2-)"
echo "$package =$version" >> "$REPO/repo.toml"
fi
done
elif [ -d "$ROOT/recipes/$1" ]
if [ -d "$ROOT/recipes/$1" ]
then
cd "$ROOT/recipes/$1"
source recipe.sh
......
fetch.sh 0 → 100755
#!/usr/bin/env bash -e
source config.sh
if [ $# = 0 ]
then
recipes="$(ls -1 recipes)"
else
recipes="$@"
fi
for recipe in $recipes
do
./cook.sh "$recipe" fetch
done
GIT=https://github.com/redox-os/contain.git
[workspace]
members = [
"ahcid",
"alxd",
"bgad",
"e1000d",
"nvmed",
"pcid",
"ps2d",
"rtl8168d",
"vboxd",
"vesad",
"xhcid"
]
GIT=https://github.com/redox-os/drivers
GIT=https://github.com/redox-os/drivers.git
CARGOFLAGS=--all
BINDIR="/sbin"
function recipe_update {
cp ../Cargo.toml ./
function recipe_version {
echo "0.1.1"
return 1
}
function recipe_stage {
mkdir -pv "$1/etc"
cp -v pcid.toml "$1/etc/pcid.toml"
}
GIT=https://github.com/redox-os/installer.git
GIT=https://github.com/redox-os/netstack.git
GIT=https://github.com/redox-os/orbital.git
BINDIR="/sbin"
GIT=https://github.com/redox-os/ptyd.git
GIT=https://github.com/redox-os/randd.git
GIT=https://github.com/redox-os/redoxfs.git
repo.sh 0 → 100755
#!/usr/bin/env bash -e
source config.sh
if [ $# = 0 ]
then
recipes="$(ls -1 recipes)"
else
recipes="$@"
fi
for recipe in $recipes
do
if [ ! -d "recipes/$recipe/source" ]
then
echo -e "\033[01;38;5;215mrepo - fetching $recipe\033[0m" >&2
./cook.sh "$recipe" fetch
fi
if [ ! -d "recipes/$recipe/build" ]
then
echo -e "\033[01;38;5;155mrepo - preparing $recipe\033[0m" >&2
./cook.sh "$recipe" prepare
else
TIME_SOURCE="$(find recipes/$recipe/source -type f -not -path '*/.git*' -printf "%Ts\n" | sort -nr | head -n 1)"
TIME_BUILD="$(find recipes/$recipe/build -type f -not -path '*/.git*' -printf "%Ts\n" | sort -nr | head -n 1)"
if [ "$TIME_SOURCE" -gt "$TIME_BUILD" ]
then
echo -e "\033[01;38;5;155mrepo - repreparing $recipe\033[0m" >&2
./cook.sh "$recipe" unprepare prepare
fi
fi
if [ ! -f "recipes/$recipe/stage.tar" ]
then
echo -e "\033[01;38;5;155mrepo - building $recipe\033[0m" >&2
./cook.sh "$recipe" update build stage tar
else
TIME_BUILD="$(find recipes/$recipe/build -type f -not -path '*/.git*' -printf "%Ts\n" | sort -nr | head -n 1)"
TIME_STAGE="$(stat -c "%Y" recipes/$recipe/stage.tar)"
if [ "$TIME_BUILD" -gt "$TIME_STAGE" ]
then
echo -e "\033[01;38;5;155mrepo - rebuilding $recipe\033[0m" >&2
./cook.sh "$recipe" untar unstage update build stage tar
else
echo -e "\033[01;38;5;155mrepo - $recipe up to date\033[0m" >&2
fi
fi
done
for recipe in $recipes
do
if [ "recipes/$recipe/stage.tar" -nt "$REPO/$recipe.tar" ]
then
echo -e "\033[01;38;5;155mrepo - publishing $recipe\033[0m" >&2
./cook.sh $recipe publish
fi
done
echo -e "\033[01;38;5;155mrepo - generating repo.toml\033[0m" >&2
echo "[packages]" > "$REPO/repo.toml"
for toml in "$REPO/"*".toml"
do
package="$(basename "$toml" .toml)"
if [ "$package" != "repo" ]
then
version="$(grep version "$toml" | cut -d '=' -f2-)"
echo "$package =$version" >> "$REPO/repo.toml"
fi
done
#!/usr/bin/env bash
set -e
if [ $# = 0 ]
then
recipes=$(ls -1 recipes)
else
recipes=$@
fi
publish=""
for recipe in $recipes
do
if [ ! -f "recipes/$recipe/stage.tar" ]
then
echo "$recipe: building..."
./cook.sh $recipe dist
publish="${publish} $recipe"
else
oldver=$(COOK_QUIET=1 ./cook.sh $recipe gitversion)
./cook.sh $recipe fetch
newver=$(COOK_QUIET=1 ./cook.sh $recipe gitversion)
if [ "$oldver" = "$newver" ]
then
echo "$recipe: up to date (version $newver)."
else
echo "$recipe: updating $oldver -> $newver..."
./cook.sh $recipe unstage untar dist
publish="${publish} $recipe"
fi
fi
done
for recipe in $publish
do
./cook.sh $recipe publish
done
./cook.sh repo
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment