1
0
forked from ports/contrib

gcc34: add post scripts for ccache and distcc symlinks

This commit is contained in:
Danny Rawlins 2008-05-08 18:54:02 +10:00
parent 125f90b50e
commit d669a5b6ee
3 changed files with 87 additions and 17 deletions

View File

@ -5,7 +5,7 @@
name=gcc34
version=3.4.6
release=1
release=2
source=(ftp://sources.redhat.com/pub/gcc/releases/gcc-$version/gcc-$version.tar.bz2 \
gcc-$version-linkonce.patch \
gcc-$version-unlink-if-ordinary.patch \
@ -52,21 +52,5 @@ build() {
$PKG/usr/lib/libiberty.a \
$PKG/usr/bin/*-linux-gnu-* \
$PKG/usr/lib/gcc/*/$version/include/README
# install distcc symlinks if distcc is installed
if pkginfo -i |grep '^distcc '; then
install -d $PKG/usr/lib/distcc
for c in cc${SUFFIX} c++${SUFFIX} gcc${SUFFIX} g++${SUFFIX}; do
cd $PKG/usr/lib/distcc && ln -s ../../bin/distcc $c
done
fi
# install ccache symlinks if ccache is installed
if pkginfo -i |grep '^ccache '; then
install -d $PKG/usr/lib/ccache
for c in cc${SUFFIX} c++${SUFFIX} gcc${SUFFIX} g++${SUFFIX}; do
cd $PKG/usr/lib/ccache && ln -s ../../bin/ccache $c
done
fi
}

51
gcc34/post-install Executable file
View File

@ -0,0 +1,51 @@
#!/usr/bin/env sh
if [ -e Pkgfile ]; then
. Pkgfile
else
echo 'post-install: error Pkgfile is missing.'
exit 1
fi
SUFFIX="-${version%.*}"
SYMLINKS="cc${SUFFIX} c++${SUFFIX} gcc${SUFFIX} g++${SUFFIX}"
unset SUFFIX
symlink() {
local DIRECTORY BASENAME NOT_INSTALLED
DIRECTORY="$1"
BASENAME="`basename $DIRECTORY`"
if [ -d "$DIRECTORY" ]; then
if [ -w "$DIRECTORY" ]; then
cd "$DIRECTORY"
for c in $SYMLINKS; do
if [ ! -e "$DIRECTORY/$c" ]; then
NOT_INSTALLED='yes'
fi
done
if [ $NOT_INSTALLED ]; then
echo "post-install: in directory '$DIRECTORY'."
fi
for c in $SYMLINKS; do
if [ ! -e "$DIRECTORY/$c" ]; then
ln -s "../../bin/$BASENAME" "$c"
if [ $? -gt 0 ]; then
echo "post-install: error creating symlink '../../bin/$BASENAME $c'."
exit 1
else
echo "post-install: create symlink '../../bin/$BASENAME -> $c'."
fi
fi
done
cd - > /dev/null
else
echo "post-install: error no permission to create symlink '../../bin/$BASENAME -> $c'."
exit 1
fi
fi
}
if pkginfo -i | egrep '^distcc ' > /dev/null; then
symlink '/usr/lib/distcc'
fi
if pkginfo -i | egrep '^ccache ' > /dev/null; then
symlink '/usr/lib/ccache'
fi
unset SYMLINKS
# End of file

35
gcc34/post-remove Executable file
View File

@ -0,0 +1,35 @@
#!/usr/bin/env sh
if [ -e Pkgfile ]; then
. Pkgfile
else
echo 'post-remove: error Pkgfile is missing.'
exit 1
fi
SUFFIX="-${version%.*}"
SYMLINKS="cc${SUFFIX} c++${SUFFIX} gcc${SUFFIX} g++${SUFFIX}"
unset SUFFIX
remove() {
local DIRECTORY="$1"
if [ -d "$DIRECTORY" ]; then
if [ -w "$DIRECTORY" ]; then
for c in $SYMLINKS; do
if [ -L "$DIRECTORY/$c" ]; then
rm "$DIRECTORY/$c"
if [ $? -gt 0 ]; then
echo "post-remove: error removing symlink '$DIRECTORY/$c'."
exit 1
else
echo "post-remove: removing symlink '$DIRECTORY/$c'."
fi
fi
done
else
echo "post-remove: error no permission to remove '$DIRECTORY/$c'."
exit 1
fi
fi
}
remove '/usr/lib/distcc'
remove '/usr/lib/ccache'
unset SYMLINKS
# End of file