summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Orgis2020-09-08 01:14:56 +0200
committerThomas Orgis2020-09-08 01:28:17 +0200
commitf016d3a1563b38feac284559eaf99d8d4d9080a8 (patch)
tree79eb12a6e69545f3887f7f21b6d8783dc7d7a89c
parent265221efc753e2ad9d77fca3666a099aaadb41d0 (diff)
libtool-nola, la_remove_up_trigger.function: infrastructure for dropping .la
As long as we do not have central filters for libtool archives, spells that have non-trivial lists of those files need some help: - libtool-nola: Inject that into the libtool calls of the build (sed Makefiles) to have it call the real libtool, but remove the .la files afterwards. - la_remove_up_trigger.function: Use that in UP_TRIGGERS to safely re-cast spells that reference the removed .la files in theirs.
-rw-r--r--ChangeLog3
-rwxr-xr-xla_remove_up_trigger.function32
-rwxr-xr-xlibtool-nola50
3 files changed, 85 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index a35a9a7a5a..c286b2dd58 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2020-09-08 Thomas Orgis <sobukus@orgis.org>
* smgl/smgl-test-spell, smgl/smgl-test-failspell: dummy spells for sorcery testing
+ * la_remove_up_trigger.function, libtool-nola: Support spells in removing
+ libtool archives from installations. This is helpful as long as we do not
+ have central filtering for those in sorcery.
2020-09-07 Ismael Luceno <ismael@sourcemage.org>
* libs/usbredir: new spell, USB redirection support library
diff --git a/la_remove_up_trigger.function b/la_remove_up_trigger.function
new file mode 100755
index 0000000000..3881f742a3
--- /dev/null
+++ b/la_remove_up_trigger.function
@@ -0,0 +1,32 @@
+#---------------------------------------------------------------------
+## @param check all spells (1) or only direct dependees (0)
+##
+## Check any usage of .la files from this spell by others and
+## trigger re-cast to facilitate removal of libtool archives from
+## a spell.
+#---------------------------------------------------------------------
+
+la_remove_up_trigger()
+{
+ local force_all=$1
+ local la_match=$( gaze install "$SPELL" | grep '\.la$' \
+ | while read f; do printf " -e /%s" "$(basename "$f")"; done )
+
+ message "This is an upgrade which removes libtool archives."
+ message "Determining affected spells and triggering them ..."
+
+ local check_spells
+ if [[ $force_all -gt 0 ]]; then
+ check_spells=$(gaze installed | cut -d: -f1)
+ else
+ check_spells=$(show_up_depends $SPELL 1)
+ fi
+ for other_spell in $check_spells
+ do
+ [[ $SPELL != $other_spell ]] || continue
+ match_count=$( gaze install "$other_spell" | grep '\.la$' \
+ | xargs grep $la_match | wc -l )
+ [[ "$match_count" -gt 0 ]] && up_trigger "$other_spell" cast_self
+ done
+ true
+}
diff --git a/libtool-nola b/libtool-nola
new file mode 100755
index 0000000000..f1b4874561
--- /dev/null
+++ b/libtool-nola
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+# This wraps over the actual libtool script (given as first argument)
+# and tries to remove any .la files that libtool script creates.
+# The expected call is
+# libtool [options] --mode=install [options] <library files> <directory>
+# The script runs libtool with /bin/sh (assuming it's compatible to whatever
+# we have there) and then tries to clean up after it.
+
+set -e
+
+# Run the full libtool command.
+"$@"
+
+# Assumption: file list comes after --mode=install.
+# Let's ingore anything before that.
+
+installing=false
+for arg in "$@"
+do
+ case "$arg" in
+ --mode=install)
+ installing=true
+ shift
+ ;;
+ -*)
+ shift
+ ;;
+ *)
+ if $installing; then
+ break;
+ fi
+ ;;
+ esac
+done
+
+
+if $installing; then
+ for dir in "$@"; do :; done;
+ echo "$(basename $0): Cleaning up after libtool: no .la files, please."
+ for f in "$@"
+ do
+ case "$f" in
+ *.la)
+ rm -vf "$dir/$(basename "$f")"
+ ;;
+ esac
+ done
+fi
+