summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/icecc-create-env-wrapper6
-rw-r--r--scripts/lib/ptxd_make_compiler.sh8
-rw-r--r--scripts/lib/ptxd_make_icecc_check.sh30
-rw-r--r--scripts/lib/ptxd_make_image_tgz.sh30
-rw-r--r--scripts/lib/ptxd_make_toolchain.sh12
-rw-r--r--scripts/lib/ptxd_make_toolchain_install.sh27
-rw-r--r--scripts/lib/ptxd_make_world_install.sh24
7 files changed, 100 insertions, 37 deletions
diff --git a/scripts/icecc-create-env-wrapper b/scripts/icecc-create-env-wrapper
index 31581c9..3f112c9 100755
--- a/scripts/icecc-create-env-wrapper
+++ b/scripts/icecc-create-env-wrapper
@@ -1,10 +1,6 @@
#!/bin/bash
-if grep -q -- --compression "${PTXDIST_ICECC_CREATE_ENV_REAL}"; then
- args=( --compression none )
-fi
-
-"${PTXDIST_ICECC_CREATE_ENV_REAL}" "${@}" "${args[@]}" || exit
+"${PTXDIST_ICECC_CREATE_ENV_REAL}" "${@}" --compression none || exit
ptxd_get_path *.tar*
env="${ptxd_reply}"
diff --git a/scripts/lib/ptxd_make_compiler.sh b/scripts/lib/ptxd_make_compiler.sh
index baf6f9a..733b068 100644
--- a/scripts/lib/ptxd_make_compiler.sh
+++ b/scripts/lib/ptxd_make_compiler.sh
@@ -20,9 +20,11 @@ ptxd_make_setup_target_compiler() {
compiler_prefix="$(ptxd_get_ptxconf PTXCONF_COMPILER_PREFIX)"
ptxd_lib_setup_target_wrapper &&
- PTXDIST_ICECC_CREATE_ENV_REAL="${PTXDIST_ICECC_CREATE_ENV}" \
- PTXDIST_ICECC_CREATE_ENV="${PTXDIST_WORKSPACE}/scripts/icecc-create-env-wrapper" \
- ptxd_lib_setup_target_icecc
+ if [ -n "${PTXDIST_ICECC}" ] && "${PTXDIST_ICECC}" --help | grep -q ICECC_ENV_COMPRESSION; then
+ PTXDIST_ICECC_CREATE_ENV_REAL="${PTXDIST_ICECC_CREATE_ENV}" \
+ PTXDIST_ICECC_CREATE_ENV="${PTXDIST_WORKSPACE}/scripts/icecc-create-env-wrapper" \
+ ptxd_lib_setup_target_icecc
+ fi
}
export -f ptxd_make_setup_target_compiler
diff --git a/scripts/lib/ptxd_make_icecc_check.sh b/scripts/lib/ptxd_make_icecc_check.sh
new file mode 100644
index 0000000..b1ecb25
--- /dev/null
+++ b/scripts/lib/ptxd_make_icecc_check.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+#
+# Copyright (C) 2021 by Michael Olbrich <m.olbrich@pengutronix.de>
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+
+ptxd_make_icecc_check() {
+ local sysroot_host
+
+ if [ -z "${PTXDIST_ICECC}" ]; then
+ return
+ fi
+
+ # old icerun versions cannot handle relative paths
+ sysroot_host="$(ptxd_get_ptxconf PTXCONF_SYSROOT_HOST)" &&
+ sysroot_host=".${sysroot_host#${PTXDIST_WORKSPACE}}" &&
+ mkdir -p "${sysroot_host}/bin" &&
+ ln -s /bin/true "${sysroot_host}/bin/test-icerun" &&
+ icerun "${sysroot_host}/bin/test-icerun" || {
+ echo "Disabling broken icerun!"
+ unset PTXDIST_ICERUN
+ }
+ rm -f "${sysroot_host}/bin/test-icerun"
+}
+
+ptxd_make_icecc_check
+
diff --git a/scripts/lib/ptxd_make_image_tgz.sh b/scripts/lib/ptxd_make_image_tgz.sh
index 3f87aa2..9d0847d 100644
--- a/scripts/lib/ptxd_make_image_tgz.sh
+++ b/scripts/lib/ptxd_make_image_tgz.sh
@@ -6,6 +6,24 @@
# see the README file.
#
+ptxd_make_strip_toolchain() {
+ local -a host_dirs=( \
+ "${sysroot}/lib" \
+ "${sysroot}/libexec" \
+ "${sysroot}/bin" \
+ "${sysroot}/${ptxconf_gnu_target}/bin" \
+ )
+
+ # strip all host binaries
+ find "${host_dirs[@]}" \
+ -wholename "${PTXDIST_SYSROOT_CROSS}${prefix_cross}/lib/gcc" -prune -o \
+ -type f \( -executable -o -name "*.so*" \) -print0 \
+ | xargs -0 -n1 --verbose strip --preserve-dates
+ # only fail if 'find' failed. Ignore 'strip' errors, it will fail for
+ # scripts etc.
+ return "${PIPESTATUS[0]}"
+}
+export -f ptxd_make_strip_toolchain
ptxd_make_image_tgz() {
ptxd_make_image_init || return
@@ -14,23 +32,13 @@ ptxd_make_image_tgz() {
local src="${PTXDIST_SYSROOT_CROSS}${prefix_cross}"
local dst="${pkg_dir}/$(dirname ${prefix_cross})"
local sysroot="${pkg_dir}${prefix_cross}"
- local -a host_dirs=( \
- "${sysroot}/lib" \
- "${sysroot}/libexec" \
- "${sysroot}/bin" \
- "${sysroot}/${ptxconf_gnu_target}/bin" \
- )
rm -rf "${pkg_dir}" &&
rm -f "${image_image}" &&
mkdir -p "${dst}" &&
cp -a "${src}" "${dst}" || return
- # strip all host binaries
- find "${host_dirs[@]}" \
- -wholename "${PTXDIST_SYSROOT_CROSS}${prefix_cross}/lib/gcc" -prune -o \
- -type f \( -executable -o -name "*.so*" \) -print0 \
- | xargs -0 -n1 --verbose strip --preserve-dates
+ ptxd_make_strip_toolchain &&
mkdir -p "$(dirname "${image_image}")" &&
echo "Creating $(ptxd_print_path "${image_image}") ..." &&
diff --git a/scripts/lib/ptxd_make_toolchain.sh b/scripts/lib/ptxd_make_toolchain.sh
index 0000801..e9aa06f 100644
--- a/scripts/lib/ptxd_make_toolchain.sh
+++ b/scripts/lib/ptxd_make_toolchain.sh
@@ -11,11 +11,13 @@ ptxd_make_toolchain_cleanup() {
local sysroot_target="$(ptxd_get_ptxconf PTXCONF_SYSROOT_TARGET)"
# packages install to pkgdir anyways and this avoid empty directories
- # in the final toolchain
- rmdir --ignore-fail-on-non-empty \
- {"${sysroot_cross}","${sysroot_target}"{,/usr}}/{etc,lib,{,s}bin,include,{,share/}man/{man*,},share} 2>/dev/null
- # errors may occur because the dirs may not exist (e.g. for 'ptxdist print').
- true
+ # in the final toolchain, but ensure that /lib and /usr/lib exist.
+ # The are needed to resolve .../lib/../lib64/...
+ if [ -d "${sysroot_cross}/etc" ]; then
+ rmdir --ignore-fail-on-non-empty \
+ {"${sysroot_cross}","${sysroot_target}"}/{etc,usr/{lib,{,s}bin,include,{,share/}{man/{man*,},}}} &&
+ mkdir -p "${sysroot_target}"{,/usr}/lib
+ fi
}
ptxd_make_toolchain_cleanup
diff --git a/scripts/lib/ptxd_make_toolchain_install.sh b/scripts/lib/ptxd_make_toolchain_install.sh
index 4ef49e9..5188922 100644
--- a/scripts/lib/ptxd_make_toolchain_install.sh
+++ b/scripts/lib/ptxd_make_toolchain_install.sh
@@ -8,25 +8,25 @@
ptxd_make_toolchain_install() {
local tmpfile install_helper
- local prefix="$(ptxd_get_ptxconf PTXCONF_PREFIX_CROSS)"
- local install_prefix="${ptx_install_destdir}${prefix}"
- local install_source="${PTXDIST_SYSROOT_CROSS}${prefix}"
+ local prefix_cross="$(ptxd_get_ptxconf PTXCONF_PREFIX_CROSS)"
+ local sysroot="${ptx_install_destdir}${prefix_cross}"
+ local install_source="${PTXDIST_SYSROOT_CROSS}${prefix_cross}"
- echo "Installing to ${install_prefix} ..."
+ echo "Installing to ${sysroot} ..."
- if [ -d "${install_prefix}" ]; then
- if [ -z "$(find "${install_prefix}" -maxdepth 0 -empty)" -a -z "${PTXDIST_FORCE}" ]; then
- ptxd_bailout "${install_prefix} is not empty!" \
+ if [ -d "${sysroot}" ]; then
+ if [ -z "$(find "${sysroot}" -maxdepth 0 -empty)" -a -z "${PTXDIST_FORCE}" ]; then
+ ptxd_bailout "${sysroot} is not empty!" \
"Use --force to remove the existing content first."
fi
fi
- mkdir -p "${install_prefix}" 2>/dev/null &&
- tmpfile="$(mktemp "${install_prefix}/touch.XXXXXXXX" 2>/dev/null)" &&
+ mkdir -p "${sysroot}" 2>/dev/null &&
+ tmpfile="$(mktemp "${sysroot}/touch.XXXXXXXX" 2>/dev/null)" &&
rm "${tmpfile}"
if [ $? -ne 0 ]; then
echo
- echo "'${install_prefix}' is not writable."
+ echo "'${sysroot}' is not writable."
read -t 5 -p "Press enter to install with sudo!"
if [ ${?} -ne 0 ]; then
echo
@@ -34,9 +34,10 @@ ptxd_make_toolchain_install() {
fi
install_helper=sudo
fi
- ${install_helper} rm -rf "${install_prefix}" &&
- ${install_helper} mkdir -p $(dirname "${install_prefix}") &&
+ ${install_helper} rm -rf "${sysroot}" &&
+ ${install_helper} mkdir -p $(dirname "${sysroot}") &&
${install_helper} cp -a --no-preserve=ownership \
- "${install_source}" $(dirname "${install_prefix}")
+ "${install_source}" $(dirname "${sysroot}") &&
+ ptxd_make_strip_toolchain
}
export -f ptxd_make_toolchain_install
diff --git a/scripts/lib/ptxd_make_world_install.sh b/scripts/lib/ptxd_make_world_install.sh
index 28a9e72..651fbde 100644
--- a/scripts/lib/ptxd_make_world_install.sh
+++ b/scripts/lib/ptxd_make_world_install.sh
@@ -118,3 +118,27 @@ ptxd_make_world_install_pack() {
fi
}
export -f ptxd_make_world_install_pack
+
+ptxd_make_world_install_src() {
+ local base dst
+ ptxd_make_world_init || break
+
+ if [ "$(ptxd_get_ptxconf PTXCONF_TOOLCHAIN_DEBUG)" != "y" ]; then
+ return
+ fi
+
+ base="${PTXDIST_SYSROOT_CROSS}$(ptxd_get_ptxconf PTXCONF_PREFIX_CROSS)/src"
+ dst="${base}/$(basename ${pkg_dir})"
+ echo -e "\nCopying sources to $(ptxd_print_path "${dst}") ...\n"
+ mkdir -p "${base}" &&
+ rm -rf "${dst}" &&
+ cp -a "${pkg_dir}" "${dst}" &&
+ rm -f "${dst}/.pc/.quilt_patches" &&
+ if [ -e "${dst}/.ptxdist" ]; then
+ # patches and series are symlinked to the BSP, explicit copy the
+ # actual files here
+ rm -r "${dst}/.ptxdist" &&
+ cp -aL "${pkg_dir}/.ptxdist" "${dst}/.ptxdist"
+ fi
+}
+export -f ptxd_make_world_install_src