diff --git a/recipes/libs/openssl1/recipe.toml b/recipes/libs/openssl1/recipe.toml index 5442e10c..8711e4be 100644 --- a/recipes/libs/openssl1/recipe.toml +++ b/recipes/libs/openssl1/recipe.toml @@ -7,11 +7,12 @@ template = "custom" script = """ DYNAMIC_INIT ARCH="${TARGET%%-*}" +OS=$(echo "${TARGET}" | cut -d - -f3) COOKBOOK_CONFIGURE="${COOKBOOK_SOURCE}/Configure" COOKBOOK_CONFIGURE_FLAGS=( threads no-dgram - "redox-${ARCH}" + "${OS}-${ARCH}" --prefix="/" ) diff --git a/recipes/wip/libs/tls/openssl3/recipe.toml b/recipes/wip/libs/tls/openssl3/recipe.toml index 6ce485ee..7b4acf98 100644 --- a/recipes/wip/libs/tls/openssl3/recipe.toml +++ b/recipes/wip/libs/tls/openssl3/recipe.toml @@ -11,17 +11,24 @@ dependencies = [ script = """ DYNAMIC_INIT ARCH="${TARGET%%-*}" +OS=$(echo "${TARGET}" | cut -d - -f3) export ARFLAGS=cr COOKBOOK_CONFIGURE="${COOKBOOK_SOURCE}/Configure" COOKBOOK_CONFIGURE_FLAGS=( no-tests no-unit-test - shared zlib enable-zstd - "redox-${ARCH}" + "${OS}-${ARCH}" --prefix="/usr" ) + +if [ "${COOKBOOK_DYNAMIC}" = "1" ]; then + COOKBOOK_CONFIGURE_FLAGS+=(shared) +else + COOKBOOK_CONFIGURE_FLAGS+=(no-shared) +fi + "${COOKBOOK_CONFIGURE}" "${COOKBOOK_CONFIGURE_FLAGS[@]}" "${COOKBOOK_MAKE}" -j1 # bug in make/ar "${COOKBOOK_MAKE}" install_sw install_ssldirs DESTDIR="${COOKBOOK_STAGE}" diff --git a/src/cook/cook_build.rs b/src/cook/cook_build.rs index 8bac2f1c..6d95bb7d 100644 --- a/src/cook/cook_build.rs +++ b/src/cook/cook_build.rs @@ -229,12 +229,16 @@ pub fn build( logger, &sysroot_dir, target_dir.join("sysroot.tmp"), - &dep_pkgars, + if name.is_host() { + &dep_host_pkgars + } else { + &dep_pkgars + }, source_modified, deps_modified, )?; } - if recipe.build.kind != BuildKind::Remote && dep_host_pkgars.len() > 0 { + if recipe.build.kind != BuildKind::Remote && !name.is_host() && dep_host_pkgars.len() > 0 { build_deps_dir( logger, &toolchain_dir, @@ -347,6 +351,8 @@ pub fn build( command.env("COOKBOOK_SYSROOT", &cookbook_sysroot); if let Some(cookbook_toolchain) = &cookbook_toolchain { command.env("COOKBOOK_TOOLCHAIN", cookbook_toolchain); + } else if name.is_host() { + command.env("COOKBOOK_TOOLCHAIN", &cookbook_sysroot); } command.env("COOKBOOK_MAKE_JOBS", cli_jobs.to_string()); if cli_verbose { diff --git a/src/cook/script.rs b/src/cook/script.rs index 5b48fabb..7aa5818f 100644 --- a/src/cook/script.rs +++ b/src/cook/script.rs @@ -14,6 +14,8 @@ function DYNAMIC_INIT { ;; "x86_64-unknown-linux-gnu") ;; + "aarch64-unknown-linux-gnu") + ;; *) [ -z "${COOKBOOK_VERBOSE}" ] || echo "WARN: ${TARGET} does not support dynamic linking." >&2 return @@ -202,6 +204,11 @@ COOKBOOK_CMAKE_FLAGS=( -DENABLE_STATIC=True ) function cookbook_cmake { +if [ "$(echo "${TARGET}" | cut -d - -f3)" = "linux" ]; then + SYSTEM_NAME="Linux" +else + SYSTEM_NAME="UnixPaths" +fi cat > cross_file.cmake <> cross_file.txt echo "[host_machine]" >> cross_file.txt - echo "system = 'redox'" >> cross_file.txt + echo "system = '$(echo "${TARGET}" | cut -d - -f3)'" >> cross_file.txt echo "cpu_family = '$(echo "${TARGET}" | cut -d - -f1)'" >> cross_file.txt echo "cpu = '$(echo "${TARGET}" | cut -d - -f1)'" >> cross_file.txt echo "endian = 'little'" >> cross_file.txt diff --git a/src/recipe.rs b/src/recipe.rs index 317e1465..f3204a6d 100644 --- a/src/recipe.rs +++ b/src/recipe.rs @@ -208,8 +208,30 @@ impl Recipe { } impl CookRecipe { - pub fn new(name: PackageName, dir: PathBuf, recipe: Recipe) -> Result { + pub fn new(name: PackageName, dir: PathBuf, mut recipe: Recipe) -> Result { let target = package_target(&name); + if name.is_host() { + let thisname = name.name(); + let fn_map = |p: PackageName| { + if p.is_host() { + if p.name() == thisname { None } else { Some(p) } + } else { + Some(PackageName::new(format!("host:{}", p.as_str())).unwrap()) + } + }; + recipe.build.dependencies = recipe + .build + .dependencies + .into_iter() + .filter_map(fn_map) + .collect(); + recipe.build.dev_dependencies = recipe + .build + .dev_dependencies + .into_iter() + .filter_map(fn_map) + .collect(); + } Ok(Self { name, dir,