diff options
author | Danny Rawlins <romster@shortcircuit.net.au> | 2008-05-08 22:10:05 +1000 |
---|---|---|
committer | Danny Rawlins <romster@shortcircuit.net.au> | 2008-05-08 22:10:05 +1000 |
commit | 72f26b13c0b15f81f4a20a72169105ae0a9af6e4 (patch) | |
tree | be0c9a308383798bc5bfcb5abf7f181aa8c9c1ae /gcc-fortran | |
parent | 324689f60e79145ef153b92b564cbd5d63604ef0 (diff) | |
download | contrib-72f26b13c0b15f81f4a20a72169105ae0a9af6e4.tar.gz contrib-72f26b13c0b15f81f4a20a72169105ae0a9af6e4.tar.xz |
gcc-fortran: add post-install and post-remove for ccache and distcc
Diffstat (limited to 'gcc-fortran')
-rw-r--r-- | gcc-fortran/Pkgfile | 19 | ||||
-rwxr-xr-x | gcc-fortran/post-install | 43 | ||||
-rwxr-xr-x | gcc-fortran/post-remove | 27 |
3 files changed, 71 insertions, 18 deletions
diff --git a/gcc-fortran/Pkgfile b/gcc-fortran/Pkgfile index 4a1eecf41..4551fbcaf 100644 --- a/gcc-fortran/Pkgfile +++ b/gcc-fortran/Pkgfile @@ -6,7 +6,7 @@ name=gcc-fortran version=4.2.3 -release=1 +release=2 source=(ftp://sources.redhat.com/pub/gcc/releases/gcc-$version/gcc-{core,fortran}-$version.tar.bz2 \ gcc-fortran-$version-nocheck-fixincludes.patch \ gcc-fortran-$version-fixinc.patch) @@ -17,7 +17,6 @@ build() { sed -i gcc-$version/gcc/version.c \ -e 's|VERSUFFIX ""|VERSUFFIX " (CRUX)"|' - mkdir build cd build @@ -70,21 +69,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 f90 f95 gfortran; 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 f90 f95 gfortran; do - cd $PKG/usr/lib/ccache && ln -s ../../bin/ccache $c - done - fi } diff --git a/gcc-fortran/post-install b/gcc-fortran/post-install new file mode 100755 index 000000000..ab574f356 --- /dev/null +++ b/gcc-fortran/post-install @@ -0,0 +1,43 @@ +#!/usr/bin/env sh +SYMLINKS='f90 f95 gfortran' +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 diff --git a/gcc-fortran/post-remove b/gcc-fortran/post-remove new file mode 100755 index 000000000..20ee3a2e1 --- /dev/null +++ b/gcc-fortran/post-remove @@ -0,0 +1,27 @@ +#!/usr/bin/env sh +SYMLINKS='f90 f95 gfortran' +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 |