forked from ports/contrib
gcj: add post-install and post-remove for ccache and distcc
This commit is contained in:
parent
d5ce0df99d
commit
324689f60e
18
gcj/Pkgfile
18
gcj/Pkgfile
@ -6,7 +6,7 @@
|
||||
|
||||
name=gcj
|
||||
version=4.2.3
|
||||
release=1
|
||||
release=2
|
||||
source=(ftp://ftp.gnu.org/pub/gnu/gcc/gcc-$version/gcc-{core,g++,java}-$version.tar.bz2 \
|
||||
gcj-$version-nocheck-fixincludes.patch \
|
||||
gcj-$version-fixinc.patch)
|
||||
@ -68,21 +68,5 @@ build() {
|
||||
for i in `find $PKG -name '*.la' | sed -e "s|$PKG|/|"`; do
|
||||
sed -i "s|-L$SRC[^ ]* ||g" $PKG/$i
|
||||
done
|
||||
|
||||
# install distcc symlinks if distcc is installed
|
||||
if pkginfo -i |grep '^distcc '; then
|
||||
install -d $PKG/usr/lib/distcc
|
||||
for c in gcj jc1; 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 gcj jc1; do
|
||||
cd $PKG/usr/lib/ccache && ln -s ../../bin/ccache $c
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
|
43
gcj/post-install
Executable file
43
gcj/post-install
Executable file
@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env sh
|
||||
SYMLINKS='gcj jc1'
|
||||
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
|
27
gcj/post-remove
Executable file
27
gcj/post-remove
Executable file
@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env sh
|
||||
SYMLINKS='gcj jc1'
|
||||
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
|
Loading…
x
Reference in New Issue
Block a user