# HG changeset patch # User Pascal Bellard # Date 1596313716 0 # Node ID 9ac8cdea12e8fb84e1a82560db39fc84e43279ff # Parent 4290aebd767891cc1c944b3ccd95c651c3bd03c5 gcc83-lib-base: restore gcc-lib-base on removal diff -r 4290aebd7678 -r 9ac8cdea12e8 gcc83-lib-base/receipt --- a/gcc83-lib-base/receipt Sat Aug 01 16:55:00 2020 +0000 +++ b/gcc83-lib-base/receipt Sat Aug 01 20:28:36 2020 +0000 @@ -15,8 +15,10 @@ genpkg_rules() { mkdir -p $fs/usr/lib $fs/usr/libgcc83 - cp -a $install/usr/libgcc83/libgcc_s.so* $fs/usr/lib - cp -a $install/usr/libgcc83/libstdc++.so* $fs/usr/lib + for i in $install/usr/libgcc83/libgcc_s.so* ; do + cp -a $i $fs/usr/lib/next.$(basename $i) + done + cp -a $install/usr/libgcc83/libstdc++.so.*.*.* $fs/usr/lib cp -a $install/usr/libgcc83/libstdc++.la $fs/usr/libgcc83 ln -s ../lib/libstdc++.so $fs/usr/libgcc83 rm -f $fs/usr/lib/*-gdb.py @@ -25,19 +27,47 @@ pre_install() { cd "$1/usr/lib" - [ -s libgcc_s.so.1 ] && cp -a libgcc_s.so.1 libgcc_s.so.1.prev + local lib=$(ls libstdc++.so.6.*.* 2> /dev/null) + [ "$lib" ] && cp -a $lib prev.$lib + [ -s libgcc_s.so.1 ] && for i in libgcc_s.so*; do + cp -a $i prev.$i + done + cd - >/dev/null +} + +post_install() +{ + cd "$1/usr/lib" + ln -fs libstdc++.so.6.*.* libstdc++.so.6 + ln -fs libstdc++.so.6.*.* libstdc++.so + for i in next.libgcc_s.so* ; do + cp -af $i ${i#next.} + done + cd - >/dev/null +} + +pre_remove() +{ + cd "$1/usr/lib" + local lib=$(ls prev.libstdc++.so.6.*.* 2> /dev/null) + if [ "$lib" ]; then + mv -f $lib ${lib#prev.} + ln -fs ${lib#prev.} libstdc++.so.6 + ln -fs ${lib#prev.} libstdc++.so + else + rm -f libstdc++.so.6 libstdc++.so + fi + for i in libgcc_s.so* ; do + cp -a $i next.$i + done cd - >/dev/null } post_remove() { cd "$1/usr/lib" - if [ "$(ls libstdc++.so.6.*.* 2> /dev/null)" ]; then - ln -s libstdc++.so.6.*.* libstdc++.so.6 - ln -s libstdc++.so.6.*.* libstdc++.so - fi - [ -s libgcc_s.so.1.prev ] && mv libgcc_s.so.1.prev libgcc_s.so.1 + [ -s prev.libgcc_s.so.1 ] && for i in prev.libgcc_s.so* ; do + mv -f $i ${i#prev.} + done || rm -f libgcc_s.so* cd - >/dev/null - - tazpkg -gi gcc-lib-base --forced }