summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2010-10-02 12:46:03 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2010-10-28 11:35:56 +0200
commit7dad70a7a44da6867c5b370a7298b8ac11241547 (patch)
tree8ae50bd227430ad0a18ee5a270bfbb2bf93b73fd
parentf057ece98fa7a242f0a2773caaec53a60773c982 (diff)
downloadptxdist-7dad70a7a44da6867c5b370a7298b8ac11241547.tar.gz
ptxdist-7dad70a7a44da6867c5b370a7298b8ac11241547.tar.xz
[scripts] define some variables earlier
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rw-r--r--scripts/lib/ptxd_lib_00-init.sh106
-rw-r--r--scripts/lib/ptxd_make_00-init.sh92
2 files changed, 109 insertions, 89 deletions
diff --git a/scripts/lib/ptxd_lib_00-init.sh b/scripts/lib/ptxd_lib_00-init.sh
new file mode 100644
index 000000000..42d982be0
--- /dev/null
+++ b/scripts/lib/ptxd_lib_00-init.sh
@@ -0,0 +1,106 @@
+#!/bin/bash
+#
+# Copyright (C) 2009 by Marc Kleine-Budde <mkl@pengutronix.de>
+# 2010 by Michael Olbrich <m.olbrich@pengutronix.de>
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+
+#
+# figure out if we use a production or base BSP
+#
+# out:
+# sysroot_base_platform
+#
+ptxd_init_get_sysroot_base_platform() {
+ local prefix
+
+ if prefix="$(ptxd_get_ptxconf PTXCONF_PROJECT_USE_PRODUCTION_PREFIX)"; then
+ local platform
+ if platform="$(ptxd_get_ptxconf PTXCONF_PLATFORM)"; then
+ local platform_version="$(ptxd_get_ptxconf PTXCONF_PLATFORM_VERSION)"
+ prefix="${prefix}/platform-${platform}${platform_version}"
+ else
+ : # nothing to do for non-platform BSPs
+ fi
+ elif prefix="$(ptxd_get_ptxconf PTXCONF_PROJECT_USE_LOCAL_PLATFORM_NAME)"; then
+ prefix="${PTXDIST_WORKSPACE}/${prefix}"
+ else
+ return
+ fi
+
+ # FIXME: HACK we hardcode "sysroot-target" here
+ sysroot_base_platform="${prefix}/sysroot-target"
+
+ if [ ! -d "${sysroot_base_platform}" ]; then
+ ptxd_bailout "$(ptxd_print_path "${prefix}") is not a valid platform."
+ fi
+
+ PTXDIST_BASE_PLATFORMDIR="${prefix}"
+ export PTXDIST_BASE_PLATFORMDIR
+}
+
+
+#
+# gather all sysroots
+#
+# out:
+# PTXDIST_PATH_SYSROOT additional sysroots (without toolchain)
+# PTXDIST_PATH_SYSROOT_ALL all sysroots (including toolchain)
+# PTXDIST_PATH_SYSROOT_PREFIX prefixes (/, /usr) of additional sysroots (without toolchain)
+# PTXDIST_PATH_SYSROOT_PREFIX_ALL prefixes (/, /usr) of all sysroots (including toolchain)
+#
+ptxd_init_ptxdist_path_sysroot() {
+ local sysroot="$(ptxd_get_ptxconf PTXCONF_SYSROOT_TARGET)"
+ local sysroot_prefix="${sysroot}:${sysroot}/usr"
+
+ local sysroot_base_platform
+ if ptxd_init_get_sysroot_base_platform; then
+ sysroot="${sysroot}:${sysroot_base_platform}"
+ sysroot_prefix="${sysroot_prefix}:${sysroot_base_platform}:${sysroot_base_platform}/usr"
+ fi
+
+ local sysroot_all="${sysroot}"
+ local sysroot_prefix_all="${sysroot_prefix}"
+ if [ -n "${PTXDIST_SYSROOT_TOOLCHAIN}" ]; then
+ sysroot_all="${sysroot_all}:${PTXDIST_SYSROOT_TOOLCHAIN}"
+ sysroot_prefix_all="${sysroot_prefix}:${PTXDIST_SYSROOT_TOOLCHAIN}:${PTXDIST_SYSROOT_TOOLCHAIN}/usr"
+ fi
+
+ export \
+ PTXDIST_PATH_SYSROOT="${sysroot}" \
+ PTXDIST_PATH_SYSROOT_ALL="${sysroot_all}" \
+ PTXDIST_PATH_SYSROOT_PREFIX="${sysroot_prefix}" \
+ PTXDIST_PATH_SYSROOT_PREFIX_ALL="${sysroot_prefix_all}"
+}
+
+
+#
+#
+#
+ptxd_init_ptxdist_path() {
+ PTXDIST_PATH="${PTXDIST_WORKSPACE}:${PTXDIST_PLATFORMCONFIGDIR}:${PTXDIST_TOPDIR}:"
+ export PTXDIST_PATH
+
+ PTXDIST_PATH_PATCHES="${PTXDIST_PATH//://patches:}"
+ export PTXDIST_PATH_PATCHES
+
+ PTXDIST_PATH_RULES="${PTXDIST_PATH//://rules:}"
+ export PTXDIST_PATH_RULES
+
+ ptxd_init_ptxdist_path_sysroot
+}
+
+
+#
+# initialize vars needed by PTXdist's libs
+#
+ptxd_lib_init() {
+ ptxd_init_ptxdist_path
+}
+ptxd_lib_init
+
diff --git a/scripts/lib/ptxd_make_00-init.sh b/scripts/lib/ptxd_make_00-init.sh
index 591b780e8..a251cda67 100644
--- a/scripts/lib/ptxd_make_00-init.sh
+++ b/scripts/lib/ptxd_make_00-init.sh
@@ -73,42 +73,6 @@ ptxd_init_sysroot_toolchain() {
}
-
-#
-# figure out if we use a production or base BSP
-#
-# out:
-# sysroot_base_platform
-#
-ptxd_init_get_sysroot_base_platform() {
- local prefix
-
- if prefix="$(ptxd_get_ptxconf PTXCONF_PROJECT_USE_PRODUCTION_PREFIX)"; then
- local platform
- if platform="$(ptxd_get_ptxconf PTXCONF_PLATFORM)"; then
- local platform_version="$(ptxd_get_ptxconf PTXCONF_PLATFORM_VERSION)"
- prefix="${prefix}/platform-${platform}${platform_version}"
- else
- : # nothing to do for non-platform BSPs
- fi
- elif prefix="$(ptxd_get_ptxconf PTXCONF_PROJECT_USE_LOCAL_PLATFORM_NAME)"; then
- prefix="${PTXDIST_WORKSPACE}/${prefix}"
- else
- return
- fi
-
- # FIXME: HACK we hardcode "sysroot-target" here
- sysroot_base_platform="${prefix}/sysroot-target"
-
- if [ ! -d "${sysroot_base_platform}" ]; then
- ptxd_bailout "$(ptxd_print_path "${prefix}") is not a valid platform."
- fi
-
- PTXDIST_BASE_PLATFORMDIR="${prefix}"
- export PTXDIST_BASE_PLATFORMDIR
-}
-
-
#
# fixup collectionconfig when using another platform
#
@@ -132,58 +96,6 @@ ptxd_init_collectionconfig() {
export PTXDIST_BASE_PACKAGES
}
-#
-# gather all sysroots
-#
-# out:
-# PTXDIST_PATH_SYSROOT additional sysroots (without toolchain)
-# PTXDIST_PATH_SYSROOT_ALL all sysroots (including toolchain)
-# PTXDIST_PATH_SYSROOT_PREFIX prefixes (/, /usr) of additional sysroots (without toolchain)
-# PTXDIST_PATH_SYSROOT_PREFIX_ALL prefixes (/, /usr) of all sysroots (including toolchain)
-#
-ptxd_init_ptxdist_path_sysroot() {
- local sysroot="$(ptxd_get_ptxconf PTXCONF_SYSROOT_TARGET)"
- local sysroot_prefix="${sysroot}:${sysroot}/usr"
-
- local sysroot_base_platform
- if ptxd_init_get_sysroot_base_platform; then
- sysroot="${sysroot}:${sysroot_base_platform}"
- sysroot_prefix="${sysroot_prefix}:${sysroot_base_platform}:${sysroot_base_platform}/usr"
- ptxd_init_collectionconfig
- fi
-
- local sysroot_all="${sysroot}"
- local sysroot_prefix_all="${sysroot_prefix}"
- if [ -n "${PTXDIST_SYSROOT_TOOLCHAIN}" ]; then
- sysroot_all="${sysroot_all}:${PTXDIST_SYSROOT_TOOLCHAIN}"
- sysroot_prefix_all="${sysroot_prefix}:${PTXDIST_SYSROOT_TOOLCHAIN}:${PTXDIST_SYSROOT_TOOLCHAIN}/usr"
- fi
-
- export \
- PTXDIST_PATH_SYSROOT="${sysroot}" \
- PTXDIST_PATH_SYSROOT_ALL="${sysroot_all}" \
- PTXDIST_PATH_SYSROOT_PREFIX="${sysroot_prefix}" \
- PTXDIST_PATH_SYSROOT_PREFIX_ALL="${sysroot_prefix_all}"
-}
-
-
-#
-#
-#
-ptxd_init_ptxdist_path() {
- PTXDIST_PATH="${PTXDIST_WORKSPACE}:${PTXDIST_PLATFORMCONFIGDIR}:${PTXDIST_TOPDIR}:"
- export PTXDIST_PATH
-
- PTXDIST_PATH_PATCHES="${PTXDIST_PATH//://patches:}"
- export PTXDIST_PATH_PATCHES
-
- PTXDIST_PATH_RULES="${PTXDIST_PATH//://rules:}"
- export PTXDIST_PATH_RULES
-
- ptxd_init_ptxdist_path_sysroot
-}
-
-
#
# setup compiler and pkgconfig environment
@@ -298,7 +210,9 @@ ptxd_make_init() {
ptxd_init_devpkg &&
- ptxd_init_ptxdist_path &&
+ if [ -n "${PTXDIST_BASE_PLATFORMDIR}" ]; then
+ ptxd_init_collectionconfig
+ fi &&
ptxd_init_cross_env
}
ptxd_make_init