mirror of
https://gitlab.redox-os.org/redox-os/redox.git
synced 2026-06-20 11:54:17 +08:00
Add optional script to transform source after patches, add more recipes
This commit is contained in:
parent
2ea2a056ed
commit
94d85accd3
14
recipes/bootloader/recipe.toml
Normal file
14
recipes/bootloader/recipe.toml
Normal file
@ -0,0 +1,14 @@
|
||||
[source]
|
||||
git = "https://gitlab.redox-os.org/redox-os/bootloader.git"
|
||||
|
||||
[build]
|
||||
template = "custom"
|
||||
script = """
|
||||
ARCH="$(echo "${TARGET}" | cut -d - -f1)"
|
||||
nasm \
|
||||
-f bin \
|
||||
-o "${COOKBOOK_STAGE}/bootloader" \
|
||||
-D "ARCH_${ARCH}" \
|
||||
-i"${COOKBOOK_SOURCE}/${ARCH}/" \
|
||||
"${COOKBOOK_SOURCE}/${ARCH}/disk.asm"
|
||||
"""
|
||||
27
recipes/drivers/recipe.toml
Normal file
27
recipes/drivers/recipe.toml
Normal file
@ -0,0 +1,27 @@
|
||||
[source]
|
||||
git = "https://gitlab.redox-os.org/redox-os/drivers.git"
|
||||
|
||||
[build]
|
||||
template = "custom"
|
||||
script = """
|
||||
redoxer build --release \
|
||||
--manifest-path "${COOKBOOK_SOURCE}/Cargo.toml" \
|
||||
--workspace
|
||||
|
||||
mkdir -pv "${COOKBOOK_STAGE}/bin"
|
||||
find "target/${TARGET}/release" \
|
||||
-maxdepth 1 \
|
||||
-executable \
|
||||
-type f \
|
||||
-exec cp -v {} "${COOKBOOK_STAGE}/bin/" ';'
|
||||
|
||||
mkdir -pv "${COOKBOOK_STAGE}/etc/pcid"
|
||||
cp -v "${COOKBOOK_SOURCE}/initfs.toml" "${COOKBOOK_STAGE}/etc/pcid/initfs.toml"
|
||||
|
||||
mkdir -pv "${COOKBOOK_STAGE}/etc/pcid.d"
|
||||
find "${COOKBOOK_SOURCE}" -maxdepth 2 -type f -name 'config.toml' | while read conf
|
||||
do
|
||||
driver="$(basename "$(dirname "$conf")")"
|
||||
cp -v "$conf" "${COOKBOOK_STAGE}/etc/pcid.d/$driver.toml"
|
||||
done
|
||||
"""
|
||||
14
recipes/libiconv/recipe.toml
Normal file
14
recipes/libiconv/recipe.toml
Normal file
@ -0,0 +1,14 @@
|
||||
[source]
|
||||
tar = "https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz"
|
||||
patches = [
|
||||
"01_redox.patch"
|
||||
]
|
||||
|
||||
[build]
|
||||
template = "custom"
|
||||
script = """
|
||||
COOKBOOK_CONFIGURE_FLAGS+=(
|
||||
ac_cv_have_decl_program_invocation_name=no
|
||||
)
|
||||
cookbook_configure
|
||||
"""
|
||||
5
recipes/libjpeg/recipe.toml
Normal file
5
recipes/libjpeg/recipe.toml
Normal file
@ -0,0 +1,5 @@
|
||||
[source]
|
||||
tar = "http://ijg.org/files/jpegsrc.v9c.tar.gz"
|
||||
|
||||
[build]
|
||||
template = "configure"
|
||||
10
recipes/liborbital/recipe.toml
Normal file
10
recipes/liborbital/recipe.toml
Normal file
@ -0,0 +1,10 @@
|
||||
[source]
|
||||
git = "https://gitlab.redox-os.org/redox-os/liborbital.git"
|
||||
|
||||
[build]
|
||||
template = "custom"
|
||||
script = """
|
||||
rsync -av --delete "${COOKBOOK_SOURCE}/" ./
|
||||
"${COOKBOOK_CARGO}" build --release
|
||||
"${COOKBOOK_MAKE}" install HOST="${TARGET}" DESTDIR="${COOKBOOK_STAGE}"
|
||||
"""
|
||||
9
recipes/libsodium/recipe.toml
Normal file
9
recipes/libsodium/recipe.toml
Normal file
@ -0,0 +1,9 @@
|
||||
[source]
|
||||
tar = "https://github.com/jedisct1/libsodium/archive/1.0.16.tar.gz"
|
||||
patches = [
|
||||
"random.patch"
|
||||
]
|
||||
script = "./autogen.sh"
|
||||
|
||||
[build]
|
||||
template = "configure"
|
||||
@ -5,20 +5,16 @@ patches = [
|
||||
"02-o_noctty.patch",
|
||||
"03-no-signals.patch"
|
||||
]
|
||||
script = """
|
||||
./autogen.sh
|
||||
chmod +w build-aux/config.sub
|
||||
wget -O build-aux/config.sub http://git.savannah.gnu.org/cgit/config.git/plain/config.sub
|
||||
"""
|
||||
|
||||
[build]
|
||||
template = "custom"
|
||||
script = """
|
||||
#TODO: simpler recipe
|
||||
rsync -av --delete "${COOKBOOK_SOURCE}/" ./
|
||||
|
||||
./autogen.sh
|
||||
|
||||
chmod +w build-aux/config.sub
|
||||
wget -O build-aux/config.sub http://git.savannah.gnu.org/cgit/config.git/plain/config.sub
|
||||
|
||||
export CFLAGS="-static"
|
||||
COOKBOOK_CONFIGURE="./configure"
|
||||
COOKBOOK_CONFIGURE_FLAGS=(
|
||||
--host="${TARGET}"
|
||||
--prefix=""
|
||||
|
||||
@ -173,7 +173,7 @@ fn fetch(recipe_dir: &Path, source: &SourceRecipe) -> Result<PathBuf, String> {
|
||||
command.arg("submodule").arg("update").arg("--init").arg("--recursive");
|
||||
run_command(command)?;
|
||||
},
|
||||
SourceRecipe::Tar { tar, blake3, sha256, patches } => {
|
||||
SourceRecipe::Tar { tar, blake3, sha256, patches, script } => {
|
||||
if ! source_dir.is_dir() {
|
||||
// Download tar
|
||||
//TODO: replace wget
|
||||
@ -266,6 +266,14 @@ fn fetch(recipe_dir: &Path, source: &SourceRecipe) -> Result<PathBuf, String> {
|
||||
run_command_stdin(command, patch.as_bytes())?;
|
||||
}
|
||||
|
||||
// Run source script
|
||||
if let Some(script) = script {
|
||||
let mut command = Command::new("bash");
|
||||
command.arg("-ex");
|
||||
command.current_dir(&source_dir_tmp);
|
||||
run_command_stdin(command, script.as_bytes())?;
|
||||
}
|
||||
|
||||
// Move source.tmp to source atomically
|
||||
rename(&source_dir_tmp, &source_dir)?;
|
||||
}
|
||||
|
||||
@ -29,6 +29,8 @@ pub enum SourceRecipe {
|
||||
/// A list of patch files to apply to the source
|
||||
#[serde(default)]
|
||||
patches: Vec<String>,
|
||||
/// Optional script to run to prepare the source, such as ./autogen.sh
|
||||
script: Option<String>,
|
||||
},
|
||||
}
|
||||
|
||||
@ -129,6 +131,7 @@ mod tests {
|
||||
blake3: None,
|
||||
sha256: Some("4f3fc6178a533d392064f14776b23c397ed4b9f48f5de297aba73b643f955c08".to_string()),
|
||||
patches: Vec::new(),
|
||||
script: None,
|
||||
},
|
||||
build: BuildRecipe {
|
||||
kind: BuildKind::Custom {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user