mirror of
https://gitlab.redox-os.org/redox-os/redox.git
synced 2026-06-17 15:34:18 +08:00
Build packages in separate folder per target
This commit is contained in:
parent
f0c7eeda72
commit
d7ce4d4d65
22
.gitignore
vendored
22
.gitignore
vendored
@ -1,24 +1,8 @@
|
||||
build
|
||||
repo
|
||||
/build
|
||||
/repo
|
||||
source
|
||||
source.tmp
|
||||
source-new
|
||||
source.tar
|
||||
source.tar.tmp
|
||||
stage
|
||||
stage.tmp
|
||||
stage.pkg
|
||||
stage.pkgar
|
||||
stage.sig
|
||||
stage.tar
|
||||
stage.tar.gz
|
||||
stage.toml
|
||||
sysroot
|
||||
sysroot.tmp
|
||||
xargo
|
||||
|
||||
|
||||
#Added by cargo
|
||||
|
||||
/target
|
||||
**/*.rs.bk
|
||||
target
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
export PKG_CONFIG_SYSROOT_DIR="${COOKBOOK_RECIPE}/sysroot"
|
||||
export PKG_CONFIG_SYSROOT_DIR="${COOKBOOK_SYSROOT}"
|
||||
export PKG_CONFIG_LIBDIR="${PKG_CONFIG_SYSROOT_DIR}/lib/pkgconfig"
|
||||
export PKG_CONFIG_PATH="${PKG_CONFIG_SYSROOT_DIR}/share/pkgconfig"
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
export PKG_CONFIG_SYSROOT_DIR="${COOKBOOK_RECIPE}/sysroot"
|
||||
export PKG_CONFIG_SYSROOT_DIR="${COOKBOOK_SYSROOT}"
|
||||
export PKG_CONFIG_LIBDIR="${PKG_CONFIG_SYSROOT_DIR}/lib/pkgconfig"
|
||||
export PKG_CONFIG_PATH="${PKG_CONFIG_SYSROOT_DIR}/share/pkgconfig"
|
||||
|
||||
|
||||
@ -98,7 +98,7 @@ def fail(message):
|
||||
print(message, file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
prefix = os.environ["COOKBOOK_RECIPE"] + "/sysroot"
|
||||
prefix = os.environ["COOKBOOK_SYSROOT"]
|
||||
|
||||
args = []
|
||||
link_static = False
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
export PKG_CONFIG_SYSROOT_DIR="${COOKBOOK_RECIPE}/sysroot"
|
||||
export PKG_CONFIG_SYSROOT_DIR="${COOKBOOK_SYSROOT}"
|
||||
export PKG_CONFIG_LIBDIR="${PKG_CONFIG_SYSROOT_DIR}/lib/pkgconfig"
|
||||
export PKG_CONFIG_PATH="${PKG_CONFIG_SYSROOT_DIR}/share/pkgconfig"
|
||||
|
||||
|
||||
87
cook.sh
87
cook.sh
@ -266,8 +266,8 @@ function op {
|
||||
fi
|
||||
if [ "$skip" -eq "0" ]
|
||||
then
|
||||
rm -rf sysroot
|
||||
mkdir sysroot
|
||||
rm -rf "${COOKBOOK_SYSROOT}"
|
||||
mkdir "${COOKBOOK_SYSROOT}"
|
||||
|
||||
if [ ${#BUILD_DEPENDS} -gt 0 ]
|
||||
then
|
||||
@ -279,32 +279,32 @@ function op {
|
||||
do
|
||||
pkgar \
|
||||
extract \
|
||||
sysroot \
|
||||
"${COOKBOOK_SYSROOT}" \
|
||||
--archive "$REPO/$i.pkgar" \
|
||||
--pkey "${ROOT}/build/id_ed25519.pub.toml"
|
||||
done
|
||||
fi
|
||||
|
||||
rm -rf build
|
||||
rm -rf "${COOKBOOK_BUILD}"
|
||||
if [ "$PREPARE_COPY" -eq "0" ]
|
||||
then
|
||||
mkdir build
|
||||
mkdir "${COOKBOOK_BUILD}"
|
||||
else
|
||||
cp -rp source build
|
||||
cp -rp source "${COOKBOOK_BUILD}"
|
||||
fi
|
||||
|
||||
for patch in *.patch
|
||||
do
|
||||
patch -p1 -d build < "$patch"
|
||||
patch -p1 -d "${COOKBOOK_BUILD}" < "$patch"
|
||||
done
|
||||
fi
|
||||
;;
|
||||
unprepare)
|
||||
rm -rf build
|
||||
rm -rf sysroot
|
||||
rm -rf "${COOKBOOK_BUILD}"
|
||||
rm -rf "${COOKBOOK_SYSROOT}"
|
||||
;;
|
||||
version)
|
||||
pushd build > /dev/null
|
||||
pushd "${COOKBOOK_BUILD}" > /dev/null
|
||||
skip=0
|
||||
if [ "$(type -t recipe_version)" = "function" ]
|
||||
then
|
||||
@ -317,15 +317,15 @@ function op {
|
||||
popd > /dev/null
|
||||
;;
|
||||
gitversion)
|
||||
if [ -d build/.git ]
|
||||
if [ -d "${COOKBOOK_BUILD}"/.git ]
|
||||
then
|
||||
echo "$(op $1 version)-$(git -C build rev-parse --short HEAD)"
|
||||
echo "$(op $1 version)-$(git -C "${COOKBOOK_BUILD}" rev-parse --short HEAD)"
|
||||
else
|
||||
op $1 version
|
||||
fi
|
||||
;;
|
||||
build)
|
||||
pushd build > /dev/null
|
||||
pushd "${COOKBOOK_BUILD}" > /dev/null
|
||||
skip=0
|
||||
if [ "$(type -t recipe_build)" = "function" ]
|
||||
then
|
||||
@ -352,7 +352,7 @@ function op {
|
||||
popd > /dev/null
|
||||
;;
|
||||
test)
|
||||
pushd build > /dev/null
|
||||
pushd "${COOKBOOK_BUILD}" > /dev/null
|
||||
skip=0
|
||||
if [ "$(type -t recipe_test)" = "function" ]
|
||||
then
|
||||
@ -373,7 +373,7 @@ function op {
|
||||
popd > /dev/null
|
||||
;;
|
||||
clean)
|
||||
pushd build > /dev/null
|
||||
pushd "${COOKBOOK_BUILD}" > /dev/null
|
||||
skip=0
|
||||
if [ "$(type -t recipe_clean)" = "function" ]
|
||||
then
|
||||
@ -387,10 +387,10 @@ function op {
|
||||
;;
|
||||
stage)
|
||||
op $1 unstage
|
||||
mkdir -p stage
|
||||
stage="$(realpath stage)"
|
||||
mkdir -p "${COOKBOOK_STAGE}"
|
||||
stage="$(realpath "${COOKBOOK_STAGE}")"
|
||||
source="$(realpath source)"
|
||||
pushd build > /dev/null
|
||||
pushd "${COOKBOOK_BUILD}" > /dev/null
|
||||
skip=0
|
||||
if [ "$(type -t recipe_stage)" = "function" ]
|
||||
then
|
||||
@ -438,22 +438,22 @@ function op {
|
||||
popd > /dev/null
|
||||
;;
|
||||
unstage)
|
||||
rm -rfv stage
|
||||
rm -rfv "${COOKBOOK_STAGE}"
|
||||
;;
|
||||
pkg)
|
||||
pkgar \
|
||||
create \
|
||||
--archive stage.pkgar \
|
||||
--archive "${COOKBOOK_STAGE}.pkgar" \
|
||||
--skey "${ROOT}/build/id_ed25519.toml" \
|
||||
stage
|
||||
"${COOKBOOK_STAGE}"
|
||||
;;
|
||||
unpkg)
|
||||
rm -fv stage.pkgar
|
||||
rm -fv "${COOKBOOK_STAGE}.pkgar"
|
||||
;;
|
||||
tar)
|
||||
echo "name = \"$1\"" > "stage.toml"
|
||||
echo "version = \"$(op $1 version)\"" >> "stage.toml"
|
||||
echo "target = \"$TARGET\"" >> "stage.toml"
|
||||
echo "name = \"$1\"" > "${COOKBOOK_STAGE}.toml"
|
||||
echo "version = \"$(op $1 version)\"" >> "${COOKBOOK_STAGE}.toml"
|
||||
echo "target = \"$TARGET\"" >> "${COOKBOOK_STAGE}.toml"
|
||||
|
||||
# Add runtime dependencies to package if they exist
|
||||
if [ -n "$DEPENDS" ]
|
||||
@ -461,32 +461,34 @@ function op {
|
||||
# Remove leading and trailing whitespace, replace whitespace between
|
||||
# package names with commas, and surround package names with quotes
|
||||
dependencies=$(echo -e "$DEPENDS" | sed -E 's/^[[:space:]]*//;s/[[:space:]]*$//;s/[[:space:]]+/,/g;s/[^, ][^, ]*/"&"/g')
|
||||
echo "depends = [$dependencies]" >> "stage.toml"
|
||||
else
|
||||
echo "depends = []" >> "stage.toml"
|
||||
echo "depends = [$dependencies]" >> "${COOKBOOK_STAGE}.toml"
|
||||
else
|
||||
echo "depends = []" >> "${COOKBOOK_STAGE}.toml"
|
||||
fi
|
||||
|
||||
rm -rf stage/pkg
|
||||
mkdir -p stage/pkg
|
||||
rm -rf "${COOKBOOK_STAGE}/pkg"
|
||||
mkdir -p "${COOKBOOK_STAGE}/pkg"
|
||||
|
||||
pushd stage > /dev/null
|
||||
pushd "${COOKBOOK_STAGE}" > /dev/null
|
||||
find -L . -type f | cut -d / -f 2- | sort | while read file
|
||||
do
|
||||
$SHASUM "$file" >> "pkg/$1.sha256sums"
|
||||
done
|
||||
popd > /dev/null
|
||||
|
||||
cp -v stage.toml "stage/pkg/$1.toml"
|
||||
pkg --target=$TARGET create stage
|
||||
cp -v "${COOKBOOK_STAGE}.toml" "${COOKBOOK_STAGE}/pkg/$1.toml"
|
||||
pushd "$(dirname "${COOKBOOK_STAGE}")" > /dev/null
|
||||
pkg --target="$TARGET" create "$(basename "${COOKBOOK_STAGE}")"
|
||||
popd > /dev/null
|
||||
;;
|
||||
untar)
|
||||
rm -rfv stage.tar.gz stage.sig stage.toml
|
||||
rm -rfv "${COOKBOOK_STAGE}.tar.gz" "${COOKBOOK_STAGE}.sig" "${COOKBOOK_STAGE}.toml"
|
||||
;;
|
||||
publish)
|
||||
mkdir -p "$REPO"
|
||||
cp -v stage.tar.gz "$REPO/$1.tar.gz"
|
||||
cp -v stage.sig "$REPO/$1.sig"
|
||||
cp -v stage.toml "$REPO/$1.toml"
|
||||
cp -v "${COOKBOOK_STAGE}.tar.gz" "$REPO/$1.tar.gz"
|
||||
cp -v "${COOKBOOK_STAGE}.sig" "$REPO/$1.sig"
|
||||
cp -v "${COOKBOOK_STAGE}.toml" "$REPO/$1.toml"
|
||||
;;
|
||||
unpublish)
|
||||
rm -rfv "$REPO/$1.tar.gz" "$REPO/$1.sig" "$REPO/$1.toml"
|
||||
@ -503,11 +505,18 @@ then
|
||||
then
|
||||
export COOKBOOK_RECIPE="${ROOT}/recipes/$1"
|
||||
|
||||
TARGET_DIR="${COOKBOOK_RECIPE}/target/${TARGET}"
|
||||
mkdir -p "${TARGET_DIR}"
|
||||
|
||||
export COOKBOOK_BUILD="${TARGET_DIR}/build"
|
||||
export COOKBOOK_STAGE="${TARGET_DIR}/stage"
|
||||
export COOKBOOK_SOURCE="${COOKBOOK_RECIPE}/source"
|
||||
export COOKBOOK_SYSROOT="${TARGET_DIR}/sysroot"
|
||||
|
||||
export PKG_CONFIG_ALLOW_CROSS=1
|
||||
export PKG_CONFIG_PATH=
|
||||
export PKG_CONFIG_LIBDIR="${COOKBOOK_RECIPE}/sysroot/lib/pkgconfig"
|
||||
export PKG_CONFIG_SYSROOT_DIR="${COOKBOOK_RECIPE}/sysroot"
|
||||
export PKG_CONFIG_LIBDIR="${COOKBOOK_SYSROOT}/lib/pkgconfig"
|
||||
export PKG_CONFIG_SYSROOT_DIR="${COOKBOOK_SYSROOT}"
|
||||
|
||||
cd "${COOKBOOK_RECIPE}"
|
||||
|
||||
|
||||
@ -35,9 +35,9 @@ function recipe_clean {
|
||||
}
|
||||
|
||||
function recipe_stage {
|
||||
dest="$(realpath $1)"
|
||||
dest="$(realpath "$1")"
|
||||
"$REDOX_MAKE" DESTDIR="$dest" install
|
||||
mkdir -pv "$dest/ui/apps"
|
||||
cp -v ../manifest "$dest/ui/apps/00_netsurf"
|
||||
cp -v "${COOKBOOK_RECIPE}/manifest" "$dest/ui/apps/00_netsurf"
|
||||
skip=1
|
||||
}
|
||||
|
||||
51
repo.sh
51
repo.sh
@ -22,17 +22,24 @@ fi
|
||||
|
||||
for recipe in $recipes
|
||||
do
|
||||
if [ -e "recipes/$recipe/recipe.toml" ]
|
||||
COOKBOOK_RECIPE="recipes/$recipe"
|
||||
TARGET_DIR="${COOKBOOK_RECIPE}/target/${TARGET}"
|
||||
COOKBOOK_BUILD="${TARGET_DIR}/build"
|
||||
COOKBOOK_STAGE="${TARGET_DIR}/stage"
|
||||
COOKBOOK_SOURCE="${COOKBOOK_RECIPE}/source"
|
||||
COOKBOOK_SYSROOT="${TARGET_DIR}/sysroot"
|
||||
|
||||
if [ -e "${COOKBOOK_RECIPE}/recipe.toml" ]
|
||||
then
|
||||
target/release/cook "$recipe"
|
||||
|
||||
if [ ! -f "recipes/$recipe/stage.tar.gz" ]
|
||||
if [ ! -f "${COOKBOOK_STAGE}.tar.gz" ]
|
||||
then
|
||||
echo -e "\033[01;38;5;155mrepo - legacy packaging $recipe\033[0m" >&2
|
||||
./cook.sh "$recipe" tar $DEBUG
|
||||
else
|
||||
TIME_PKG="$($STAT -c "%Y" recipes/$recipe/stage.pkgar)"
|
||||
TIME_STAGE="$($STAT -c "%Y" recipes/$recipe/stage.tar.gz)"
|
||||
TIME_PKG="$($STAT -c "%Y" "${COOKBOOK_STAGE}.pkgar")"
|
||||
TIME_STAGE="$($STAT -c "%Y" "${COOKBOOK_STAGE}.tar.gz")"
|
||||
if [ "$TIME_PKG" -gt "$TIME_STAGE" ]
|
||||
then
|
||||
echo -e "\033[01;38;5;155mrepo - legacy repackaging $recipe\033[0m" >&2
|
||||
@ -41,28 +48,28 @@ do
|
||||
fi
|
||||
|
||||
# Match pkgar and tar time
|
||||
touch --no-create --reference="recipes/$recipe/stage.tar.gz" "recipes/$recipe/stage.pkgar"
|
||||
touch --no-create --reference="${COOKBOOK_STAGE}.tar.gz" "${COOKBOOK_STAGE}.pkgar"
|
||||
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ ! -d "recipes/$recipe/source/" ]
|
||||
if [ ! -d "${COOKBOOK_SOURCE}" ]
|
||||
then
|
||||
echo -e "\033[01;38;5;155mrepo - fetching $recipe\033[0m" >&2
|
||||
./cook.sh "$recipe" fetch
|
||||
fi
|
||||
|
||||
if [ ! -d "recipes/$recipe/build/" ]
|
||||
if [ ! -d "${COOKBOOK_BUILD}" ]
|
||||
then
|
||||
echo -e "\033[01;38;5;155mrepo - preparing $recipe\033[0m" >&2
|
||||
./cook.sh "$recipe" prepare
|
||||
elif [ ! -d "recipes/$recipe/sysroot/" ]
|
||||
elif [ ! -d "${COOKBOOK_SYSROOT}" ]
|
||||
then
|
||||
echo -e "\033[01;38;5;155mrepo - repreparing $recipe\033[0m" >&2
|
||||
./cook.sh "$recipe" unprepare 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)"
|
||||
TIME_SOURCE="$($FIND "${COOKBOOK_SOURCE}" -type f -not -path '*/.git*' -printf "%Ts\n" | sort -nr | head -n 1)"
|
||||
TIME_BUILD="$($FIND "${COOKBOOK_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
|
||||
@ -70,14 +77,14 @@ do
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f "recipes/$recipe/stage.tar.gz" ]
|
||||
if [ ! -f "${COOKBOOK_STAGE}.tar.gz" ]
|
||||
then
|
||||
echo -e "\033[01;38;5;155mrepo - building $recipe\033[0m" >&2
|
||||
./cook.sh "$recipe" build stage tar $DEBUG
|
||||
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.gz)"
|
||||
TIME_RECIPE="$($FIND recipes/$recipe/{recipe.sh,*.patch} -printf '%Ts\n' | sort -nr | head -n 1)"
|
||||
TIME_BUILD="$($FIND "${COOKBOOK_BUILD}" -type f -not -path '*/.git*' -printf "%Ts\n" | sort -nr | head -n 1)"
|
||||
TIME_STAGE="$($STAT -c "%Y" "${COOKBOOK_STAGE}.tar.gz")"
|
||||
TIME_RECIPE="$($FIND "${COOKBOOK_RECIPE}"/{recipe.sh,*.patch} -printf '%Ts\n' | sort -nr | head -n 1)"
|
||||
if [ "$TIME_BUILD" -gt "$TIME_STAGE" -o "$TIME_RECIPE" -gt "$TIME_STAGE" ]
|
||||
then
|
||||
echo -e "\033[01;38;5;155mrepo - rebuilding $recipe\033[0m" >&2
|
||||
@ -87,13 +94,13 @@ do
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f "recipes/$recipe/stage.pkgar" ]
|
||||
if [ ! -f "${COOKBOOK_STAGE}.pkgar" ]
|
||||
then
|
||||
echo -e "\033[01;38;5;155mrepo - packaging $recipe\033[0m" >&2
|
||||
./cook.sh "$recipe" pkg $DEBUG
|
||||
else
|
||||
TIME_STAGE="$($STAT -c "%Y" recipes/$recipe/stage.tar.gz)"
|
||||
TIME_PKG="$($STAT -c "%Y" recipes/$recipe/stage.pkgar)"
|
||||
TIME_STAGE="$($STAT -c "%Y" "${COOKBOOK_STAGE}.tar.gz")"
|
||||
TIME_PKG="$($STAT -c "%Y" "${COOKBOOK_STAGE}.pkgar")"
|
||||
if [ "$TIME_STAGE" -gt "$TIME_PKG" ]
|
||||
then
|
||||
echo -e "\033[01;38;5;155mrepo - repackaging $recipe\033[0m" >&2
|
||||
@ -106,16 +113,20 @@ mkdir -p "$REPO"
|
||||
|
||||
for recipe in $recipes
|
||||
do
|
||||
if [ "recipes/$recipe/stage.tar.gz" -nt "$REPO/$recipe.tar.gz" ]
|
||||
COOKBOOK_RECIPE="recipes/$recipe"
|
||||
TARGET_DIR="${COOKBOOK_RECIPE}/target/${TARGET}"
|
||||
COOKBOOK_STAGE="${TARGET_DIR}/stage"
|
||||
|
||||
if [ "${COOKBOOK_STAGE}.tar.gz" -nt "$REPO/$recipe.tar.gz" ]
|
||||
then
|
||||
echo -e "\033[01;38;5;155mrepo - publishing $recipe\033[0m" >&2
|
||||
./cook.sh $recipe publish
|
||||
fi
|
||||
|
||||
if [ "recipes/$recipe/stage.pkgar" -nt "$REPO/$recipe.pkgar" ]
|
||||
if [ "${COOKBOOK_STAGE}.pkgar" -nt "$REPO/$recipe.pkgar" ]
|
||||
then
|
||||
echo -e "\033[01;38;5;155mrepo - publishing $recipe\033[0m" >&2
|
||||
cp -v "recipes/$recipe/stage.pkgar" "$REPO/$recipe.pkgar"
|
||||
cp -v "${COOKBOOK_STAGE}.pkgar" "$REPO/$recipe.pkgar"
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
@ -374,10 +374,10 @@ fi"#);
|
||||
Ok(source_dir)
|
||||
}
|
||||
|
||||
fn build(recipe_dir: &Path, source_dir: &Path, build: &BuildRecipe) -> Result<PathBuf, String> {
|
||||
fn build(recipe_dir: &Path, source_dir: &Path, target_dir: &Path, build: &BuildRecipe) -> Result<PathBuf, String> {
|
||||
let source_modified = modified_dir_ignore_git(&source_dir)?;
|
||||
|
||||
let sysroot_dir = recipe_dir.join("sysroot");
|
||||
let sysroot_dir = target_dir.join("sysroot");
|
||||
// Rebuild sysroot if source is newer
|
||||
//TODO: rebuild on recipe changes
|
||||
if sysroot_dir.is_dir() {
|
||||
@ -388,7 +388,7 @@ fn build(recipe_dir: &Path, source_dir: &Path, build: &BuildRecipe) -> Result<Pa
|
||||
}
|
||||
if ! sysroot_dir.is_dir() {
|
||||
// Create sysroot.tmp
|
||||
let sysroot_dir_tmp = recipe_dir.join("sysroot.tmp");
|
||||
let sysroot_dir_tmp = target_dir.join("sysroot.tmp");
|
||||
create_dir_clean(&sysroot_dir_tmp)?;
|
||||
|
||||
// Make sure sysroot/include exists
|
||||
@ -399,7 +399,7 @@ fn build(recipe_dir: &Path, source_dir: &Path, build: &BuildRecipe) -> Result<Pa
|
||||
for dependency in build.dependencies.iter() {
|
||||
let public_path = "build/id_ed25519.pub.toml";
|
||||
//TODO: sanitize name
|
||||
let archive_path = format!("recipes/{}/stage.pkgar", dependency);
|
||||
let archive_path = format!("recipes/{}/target/{}/stage.pkgar", dependency, redoxer::target());
|
||||
pkgar::extract(
|
||||
public_path,
|
||||
&archive_path,
|
||||
@ -416,7 +416,7 @@ fn build(recipe_dir: &Path, source_dir: &Path, build: &BuildRecipe) -> Result<Pa
|
||||
rename(&sysroot_dir_tmp, &sysroot_dir)?;
|
||||
}
|
||||
|
||||
let stage_dir = recipe_dir.join("stage");
|
||||
let stage_dir = target_dir.join("stage");
|
||||
// Rebuild stage if source is newer
|
||||
//TODO: rebuild on recipe changes
|
||||
if stage_dir.is_dir() {
|
||||
@ -427,12 +427,12 @@ fn build(recipe_dir: &Path, source_dir: &Path, build: &BuildRecipe) -> Result<Pa
|
||||
}
|
||||
if ! stage_dir.is_dir() {
|
||||
// Create stage.tmp
|
||||
let stage_dir_tmp = recipe_dir.join("stage.tmp");
|
||||
let stage_dir_tmp = target_dir.join("stage.tmp");
|
||||
create_dir_clean(&stage_dir_tmp)?;
|
||||
|
||||
// Create build, if it does not exist
|
||||
//TODO: flag for clean builds where build is wiped out
|
||||
let build_dir = recipe_dir.join("build");
|
||||
let build_dir = target_dir.join("build");
|
||||
if ! build_dir.is_dir() {
|
||||
create_dir_clean(&build_dir)?;
|
||||
}
|
||||
@ -554,7 +554,7 @@ done
|
||||
Ok(stage_dir)
|
||||
}
|
||||
|
||||
fn package(recipe_dir: &Path, stage_dir: &Path, package: &PackageRecipe) -> Result<PathBuf, String> {
|
||||
fn package(recipe_dir: &Path, stage_dir: &Path, target_dir: &Path, package: &PackageRecipe) -> Result<PathBuf, String> {
|
||||
//TODO: metadata like dependencies, name, and version
|
||||
|
||||
let secret_path = "build/id_ed25519.toml";
|
||||
@ -574,7 +574,7 @@ fn package(recipe_dir: &Path, stage_dir: &Path, package: &PackageRecipe) -> Resu
|
||||
))?;
|
||||
}
|
||||
|
||||
let package_file = recipe_dir.join("stage.pkgar");
|
||||
let package_file = target_dir.join("stage.pkgar");
|
||||
// Rebuild package if stage is newer
|
||||
//TODO: rebuild on recipe changes
|
||||
if package_file.is_file() {
|
||||
@ -606,12 +606,21 @@ fn cook(recipe_dir: &Path, recipe: &Recipe, fetch_only: bool) -> Result<(), Stri
|
||||
|
||||
if fetch_only { return Ok(()); }
|
||||
|
||||
let stage_dir = build(&recipe_dir, &source_dir, &recipe.build).map_err(|err| format!(
|
||||
let target_parent_dir = recipe_dir.join("target");
|
||||
if ! target_parent_dir.is_dir() {
|
||||
create_dir(&target_parent_dir)?;
|
||||
}
|
||||
let target_dir = target_parent_dir.join(redoxer::target());
|
||||
if ! target_dir.is_dir() {
|
||||
create_dir(&target_dir)?;
|
||||
}
|
||||
|
||||
let stage_dir = build(&recipe_dir, &source_dir, &target_dir, &recipe.build).map_err(|err| format!(
|
||||
"failed to build: {}",
|
||||
err
|
||||
))?;
|
||||
|
||||
let package_file = package(&recipe_dir, &stage_dir, &recipe.package).map_err(|err| format!(
|
||||
let package_file = package(&recipe_dir, &stage_dir, &target_dir, &recipe.package).map_err(|err| format!(
|
||||
"failed to package: {}",
|
||||
err
|
||||
))?;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user