mirror of
https://gitlab.redox-os.org/redox-os/redox.git
synced 2026-06-23 21:34:18 +08:00
feat(cook): prescript for source scripts
Signed-off-by: Anhad Singh <andypython@protonmail.com>
This commit is contained in:
parent
5c59a25ac8
commit
0f6a6e259c
@ -168,6 +168,30 @@ fn run_command_stdin(mut command: process::Command, stdin_data: &[u8]) -> Result
|
||||
Ok(())
|
||||
}
|
||||
|
||||
static SHARED_PRESCRIPT: &str = r#"
|
||||
function DYNAMIC_INIT {
|
||||
echo "WARN: Program is being compiled dynamically."
|
||||
|
||||
COOKBOOK_CONFIGURE_FLAGS=(
|
||||
--host="${GNU_TARGET}"
|
||||
--prefix=""
|
||||
--enable-shared
|
||||
--disable-static
|
||||
)
|
||||
|
||||
# TODO: check paths for spaces
|
||||
export LDFLAGS="-L${COOKBOOK_SYSROOT}/lib"
|
||||
|
||||
COOKBOOK_AUTORECONF="autoreconf"
|
||||
autotools_recursive_regenerate() {
|
||||
for f in $(find . -name configure.ac -o -name configure.in -type f | sort); do
|
||||
echo "* autotools regen in '$(dirname $f)'..."
|
||||
( cd "$(dirname "$f")" && "${COOKBOOK_AUTORECONF}" -fvi "$@" -I${COOKBOOK_HOST_SYSROOT}/share/aclocal )
|
||||
done
|
||||
}
|
||||
}
|
||||
"#;
|
||||
|
||||
fn fetch(recipe_dir: &Path, source: &Option<SourceRecipe>) -> Result<PathBuf, String> {
|
||||
let source_dir = recipe_dir.join("source");
|
||||
match source {
|
||||
@ -392,7 +416,7 @@ fi"#,
|
||||
let mut command = Command::new("bash");
|
||||
command.arg("-ex");
|
||||
command.current_dir(&source_dir_tmp);
|
||||
run_command_stdin(command, script.as_bytes())?;
|
||||
run_command_stdin(command, format!("{SHARED_PRESCRIPT}\n{script}").as_bytes())?;
|
||||
}
|
||||
|
||||
// Move source.tmp to source atomically
|
||||
@ -716,7 +740,7 @@ done
|
||||
command
|
||||
};
|
||||
|
||||
let full_script = format!("{}\n{}\n{}", pre_script, script, post_script);
|
||||
let full_script = format!("{}\n{}\n{}\n{}", pre_script, SHARED_PRESCRIPT, script, post_script);
|
||||
run_command_stdin(command, full_script.as_bytes())?;
|
||||
|
||||
// Move stage.tmp to stage atomically
|
||||
|
||||
Loading…
Reference in New Issue
Block a user