summaryrefslogtreecommitdiff
path: root/sofort
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2020-08-16 08:27:18 +0000
committermidipix <writeonce@midipix.org>2020-08-16 18:04:05 +0000
commit3158adefbfea3bd0ee64e2ef6c76e9cb5d8f77bb (patch)
treed02b4ae16034d969105c2167d455f65cee3d1a96 /sofort
parent5797b625d51859265918911dff7618e72b4aa0de (diff)
downloadsbpython3-3158adefbfea3bd0ee64e2ef6c76e9cb5d8f77bb.tar.bz2
sbpython3-3158adefbfea3bd0ee64e2ef6c76e9cb5d8f77bb.tar.xz
build system: ccenv: ccenv_set_primary_tools(): added archive format support.
Diffstat (limited to 'sofort')
-rw-r--r--sofort/ccenv/ccenv.in1
-rw-r--r--sofort/ccenv/ccenv.sh42
-rw-r--r--sofort/ccenv/ccenv.vars1
3 files changed, 44 insertions, 0 deletions
diff --git a/sofort/ccenv/ccenv.in b/sofort/ccenv/ccenv.in
index f12c78e..a8a07e3 100644
--- a/sofort/ccenv/ccenv.in
+++ b/sofort/ccenv/ccenv.in
@@ -24,6 +24,7 @@ OS_LIB_SUFFIXED_SUFFIX = @ccenv_os_lib_suffixed_suffix@
CC_HOST = @ccenv_cc_host@
CC_BITS = @ccenv_cc_bits@
+CC_ARFMT = @ccenv_cc_arfmt@
CC_BINFMT = @ccenv_cc_binfmt@
CC_UNDERSCORE = @ccenv_cc_underscore@
diff --git a/sofort/ccenv/ccenv.sh b/sofort/ccenv/ccenv.sh
index c026030..52ad423 100644
--- a/sofort/ccenv/ccenv.sh
+++ b/sofort/ccenv/ccenv.sh
@@ -226,6 +226,48 @@ ccenv_set_primary_tools()
# windrc
ccenv_windrc="$ccenv_windres"
+
+ # archive format preamble
+ ccenv_libgcc_a_header=$(od -b -N8 $($ccenv_cc -print-file-name=libgcc.a) | head -n1)
+ ccenv_cc_arfmt='common'
+
+ # ar (big)
+ ccenv_bigaf_header=$(printf '%s\n' '<bigaf>' | od -b | head -n1)
+
+ if [ "$ccenv_libgcc_a_header" = "$ccenv_bigaf_header" ]; then
+ ccenv_cc_arfmt='bigaf'
+
+ for __tool in $(printf '%s' "$ccenv_core_tools"); do
+ ccenv_var_name=ccenv_$__tool
+ ccenv_var_expr='${'$ccenv_var_name':-}'
+ eval ccenv_var_val="$ccenv_var_expr"
+
+ if [ "$ccenv_var_val" != false ]; then
+ ccenv_var_val="$ccenv_var_val -X64"
+ ccenv_var_expr='${ccenv_var_val:-}'
+ eval ccenv_$__tool="$ccenv_var_expr"
+ fi
+ done
+ fi
+
+ # ar (small)
+ ccenv_aiaff_header=$(printf '%s\n' '<aiaff>' | od -b | head -n1)
+
+ if [ "$ccenv_libgcc_a_header" = "$ccenv_aiaff_header" ]; then
+ ccenv_cc_arfmt='aiaff'
+
+ for __tool in $(printf '%s' "$ccenv_core_tools"); do
+ ccenv_var_name=ccenv_$__tool
+ ccenv_var_expr='${'$ccenv_var_name':-}'
+ eval ccenv_var_val="$ccenv_var_expr"
+
+ if [ "$ccenv_var_val" != false ]; then
+ ccenv_var_val="$ccenv_var_val -X32"
+ ccenv_var_expr='${ccenv_var_val:-}'
+ eval ccenv_$__tool="$ccenv_var_expr"
+ fi
+ done
+ fi
}
ccenv_set_tool_variants()
diff --git a/sofort/ccenv/ccenv.vars b/sofort/ccenv/ccenv.vars
index 4775b37..6d9fc3a 100644
--- a/sofort/ccenv/ccenv.vars
+++ b/sofort/ccenv/ccenv.vars
@@ -24,6 +24,7 @@ ccenv_os_lib_suffixed_suffix=
ccenv_cc_host=
ccenv_cc_bits=
+ccenv_cc_arfmt=
ccenv_cc_binfmt=
ccenv_cc_underscore=