wok rev 23904

gcc83-lib-base: restore gcc-lib-base on removal
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Aug 01 20:28:36 2020 +0000 (2 days ago)
parents 4290aebd7678
children 4bfeeef8e79f
files gcc83-lib-base/receipt
line diff
     1.1 --- a/gcc83-lib-base/receipt	Sat Aug 01 16:55:00 2020 +0000
     1.2 +++ b/gcc83-lib-base/receipt	Sat Aug 01 20:28:36 2020 +0000
     1.3 @@ -15,8 +15,10 @@
     1.4  genpkg_rules()
     1.5  {
     1.6  	mkdir -p $fs/usr/lib $fs/usr/libgcc83
     1.7 -	cp -a $install/usr/libgcc83/libgcc_s.so*	$fs/usr/lib
     1.8 -	cp -a $install/usr/libgcc83/libstdc++.so*	$fs/usr/lib
     1.9 +	for i in $install/usr/libgcc83/libgcc_s.so* ; do
    1.10 +		cp -a $i	$fs/usr/lib/next.$(basename $i)
    1.11 +	done
    1.12 +	cp -a $install/usr/libgcc83/libstdc++.so.*.*.*	$fs/usr/lib
    1.13  	cp -a $install/usr/libgcc83/libstdc++.la	$fs/usr/libgcc83
    1.14  	ln -s ../lib/libstdc++.so			$fs/usr/libgcc83
    1.15  	rm -f $fs/usr/lib/*-gdb.py
    1.16 @@ -25,19 +27,47 @@
    1.17  pre_install()
    1.18  {
    1.19  	cd "$1/usr/lib"
    1.20 -	[ -s libgcc_s.so.1 ] && cp -a libgcc_s.so.1 libgcc_s.so.1.prev 
    1.21 +	local lib=$(ls libstdc++.so.6.*.* 2> /dev/null)
    1.22 +	[ "$lib" ] && cp -a $lib prev.$lib
    1.23 +	[ -s libgcc_s.so.1 ] && for i in libgcc_s.so*; do
    1.24 +		cp -a $i prev.$i
    1.25 +	done
    1.26 +	cd - >/dev/null
    1.27 +}
    1.28 +
    1.29 +post_install()
    1.30 +{
    1.31 +	cd "$1/usr/lib"
    1.32 +	ln -fs libstdc++.so.6.*.* libstdc++.so.6
    1.33 +	ln -fs libstdc++.so.6.*.* libstdc++.so
    1.34 +	for i in next.libgcc_s.so* ; do
    1.35 +		cp -af $i ${i#next.}
    1.36 +	done
    1.37 +	cd - >/dev/null
    1.38 +}
    1.39 +
    1.40 +pre_remove()
    1.41 +{
    1.42 +	cd "$1/usr/lib"
    1.43 +	local lib=$(ls prev.libstdc++.so.6.*.* 2> /dev/null)
    1.44 +	if [ "$lib" ]; then
    1.45 +		mv -f $lib ${lib#prev.}
    1.46 +		ln -fs ${lib#prev.} libstdc++.so.6
    1.47 +		ln -fs ${lib#prev.} libstdc++.so
    1.48 +	else
    1.49 +		rm -f libstdc++.so.6 libstdc++.so
    1.50 +	fi
    1.51 +	for i in libgcc_s.so* ; do
    1.52 +		cp -a $i next.$i
    1.53 +	done
    1.54  	cd - >/dev/null
    1.55  }
    1.56  
    1.57  post_remove()
    1.58  {
    1.59  	cd "$1/usr/lib"
    1.60 -	if [ "$(ls libstdc++.so.6.*.* 2> /dev/null)" ]; then
    1.61 -		ln -s libstdc++.so.6.*.* libstdc++.so.6
    1.62 -		ln -s libstdc++.so.6.*.* libstdc++.so
    1.63 -	fi
    1.64 -	[ -s libgcc_s.so.1.prev ] && mv libgcc_s.so.1.prev libgcc_s.so.1
    1.65 +	[ -s prev.libgcc_s.so.1 ] && for i in prev.libgcc_s.so* ; do
    1.66 +		mv -f $i ${i#prev.}
    1.67 +	done || rm -f libgcc_s.so*
    1.68  	cd - >/dev/null
    1.69 -
    1.70 -	tazpkg -gi gcc-lib-base --forced
    1.71  }