summaryrefslogtreecommitdiff
path: root/scripts/build
diff options
context:
space:
mode:
authorChris Packham <judge.packham@gmail.com>2021-01-24 23:40:31 (GMT)
committerGitHub <noreply@github.com>2021-01-24 23:40:31 (GMT)
commit30316cd27ab0a6f8cb2a96771661fc88e1b05a6b (patch)
tree9831a7f7d817b28f1c77a6532d68de4ada2da85e /scripts/build
parent1678034bb637c506f3f2fdd455fa73ec76a15ff3 (diff)
parente7d0485ca2fece06e66e22162805b0e388bcc449 (diff)
Merge pull request #1448 from dinuxbg/master
Add PRU target configuration
Diffstat (limited to 'scripts/build')
-rw-r--r--scripts/build/arch/pru.sh5
-rw-r--r--scripts/build/companion_libs/400-gnuprumcu.sh89
2 files changed, 94 insertions, 0 deletions
diff --git a/scripts/build/arch/pru.sh b/scripts/build/arch/pru.sh
new file mode 100644
index 0000000..c4d61ce
--- /dev/null
+++ b/scripts/build/arch/pru.sh
@@ -0,0 +1,5 @@
+# Compute PRU-specific values
+
+CT_DoArchTupleValues() {
+ CT_TARGET_ARCH="${CT_ARCH}"
+}
diff --git a/scripts/build/companion_libs/400-gnuprumcu.sh b/scripts/build/companion_libs/400-gnuprumcu.sh
new file mode 100644
index 0000000..14546f3
--- /dev/null
+++ b/scripts/build/companion_libs/400-gnuprumcu.sh
@@ -0,0 +1,89 @@
+# Build script for gnuprumcu
+
+do_gnuprumcu_get() { :; }
+do_gnuprumcu_extract() { :; }
+do_gnuprumcu_for_build() { :; }
+do_gnuprumcu_for_host() { :; }
+do_gnuprumcu_for_target() { :; }
+
+if [ "${CT_COMP_LIBS_GNUPRUMCU}" = "y" ]; then
+
+do_gnuprumcu_get() {
+ CT_Fetch GNUPRUMCU
+}
+
+do_gnuprumcu_extract() {
+ CT_ExtractPatch GNUPRUMCU
+}
+
+
+do_gnuprumcu_for_target() {
+ local -a gnuprumcu_opts
+
+ CT_DoStep INFO "Installing gnuprumcu for the target"
+ CT_mkdir_pushd "${CT_BUILD_DIR}/build-gnuprumcu-target-${CT_TARGET}"
+
+ gnuprumcu_opts+=( "destdir=${CT_SYSROOT_DIR}" )
+ gnuprumcu_opts+=( "host=${CT_HOST}" )
+
+ gnuprumcu_opts+=( "cflags=${CT_ALL_TARGET_CFLAGS}" )
+ gnuprumcu_opts+=( "prefix=${CT_PREFIX_DIR}" )
+ do_gnuprumcu_backend "${gnuprumcu_opts[@]}"
+
+ CT_Popd
+ CT_EndStep
+}
+
+
+# Build gnuprumcu
+# Parameter : description : type : default
+# destdir : out-of-tree install dir : string : /
+# host : machine to run on : tuple : (none)
+# prefix : prefix to install into : dir : (none)
+# cflags : cflags to use : string : (empty)
+# ldflags : ldflags to use : string : (empty)
+# shared : also buils shared lib : bool : n
+do_gnuprumcu_backend() {
+ local destdir="/"
+ local host
+ local prefix
+ local cflags
+ local ldflags
+ local shared
+ local -a extra_config
+ local arg
+
+ for arg in "$@"; do
+ eval "${arg// /\\ }"
+ done
+
+ CT_DoLog EXTRA "Configuring gnuprumcu"
+
+ CT_DoExecLog CFG \
+ CC="${host}-gcc" \
+ RANLIB="${host}-ranlib" \
+ CFLAGS="${cflags}" \
+ LDFLAGS="${ldflags}" \
+ ${CONFIG_SHELL} \
+ "${CT_SRC_DIR}/gnuprumcu/configure" \
+ --build=${CT_BUILD} \
+ --host=${host} \
+ --target=${CT_TARGET} \
+ --prefix="${prefix}" \
+ "${extra_config[@]}"
+
+ CT_DoLog EXTRA "Building gnuprumcu"
+ CT_DoExecLog ALL make
+
+ CT_DoLog EXTRA "Installing gnuprumcu"
+
+ # Guard against $destdir$prefix == //
+ # which is a UNC path on Cygwin/MSYS2
+ if [[ ${destdir} == / ]] && [[ ${prefix} == /* ]]; then
+ destdir=
+ fi
+
+ CT_DoExecLog ALL make instroot="${destdir}" install
+}
+
+fi # CT_COMP_LIBS_GNUPRUMCU