wok rev 13701

Add get-xcas
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Dec 17 10:11:05 2012 +0100 (2012-12-17)
parents 837a5d71872c
children 023a32bce7dd
files get-xcas/receipt get-xcas/stuff/get-xcas
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/get-xcas/receipt	Mon Dec 17 10:11:05 2012 +0100
     1.3 @@ -0,0 +1,16 @@
     1.4 +# SliTaz package receipt.
     1.5 +
     1.6 +PACKAGE="get-xcas"
     1.7 +VERSION="1.00"
     1.8 +CATEGORY="misc"
     1.9 +SHORT_DESC="Get Xcas: Computer algebra system."
    1.10 +MAINTAINER="pascal.bellard@slitaz.org"
    1.11 +WEB_SITE="http://www-fourier.ujf-grenoble.fr/~parisse/giac.html"
    1.12 +
    1.13 +# Rules to gen a SliTaz package suitable for Tazpkg.
    1.14 +genpkg_rules()
    1.15 +{
    1.16 +	mkdir -p $fs/usr/bin
    1.17 +	cp stuff/get-xcas $fs/usr/bin
    1.18 +}
    1.19 +
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/get-xcas/stuff/get-xcas	Mon Dec 17 10:11:05 2012 +0100
     2.3 @@ -0,0 +1,110 @@
     2.4 +#!/bin/sh -e
     2.5 +
     2.6 +PACKAGE="xcas"
     2.7 +WEB_SITE="http://www-fourier.ujf-grenoble.fr/~parisse/giac.html"
     2.8 +CATEGORY="misc"
     2.9 +SHORT_DESC="Computer algebra system"
    2.10 +MAINTAINER="bernard.parisse@ujf-grenoble.fr"
    2.11 +DEPENDS=""
    2.12 +URL=http://www-fourier.ujf-grenoble.fr/~parisse/giac/xcas.tgz
    2.13 +
    2.14 +ROOT="$1"
    2.15 +[ -d "$ROOT" ] || ROOT=""
    2.16 +
    2.17 +if test $(id -u) != 0 ; then
    2.18 +        echo -e "\nYou must be root to run `basename $0`."
    2.19 +        echo -e "Please type 'su' and root password to become super-user.\n"
    2.20 +        exit 0
    2.21 +fi
    2.22 +
    2.23 +if [ -d $ROOT/var/lib/tazpkg/installed/$PACKAGE ]; then
    2.24 +	[ -n "$ROOT" ] && exit 1
    2.25 +	tazpkg remove $PACKAGE
    2.26 +	[ -d /var/lib/tazpkg/installed/$PACKAGE ] && exit 1
    2.27 +fi
    2.28 +
    2.29 +TMP_DIR=/tmp/get-$PACKAGE-$$-$RANDOM
    2.30 +CUR_DIR=$(pwd)
    2.31 +mkdir -p $TMP_DIR && cd $TMP_DIR
    2.32 +
    2.33 +get_releases()
    2.34 +{
    2.35 +	wget -qO- "$URL?C=M;O=D" | sed 's|.*[Ff]="\([^"/]*\).*|\1|;/[^0-9b]/d'
    2.36 +}
    2.37 +
    2.38 +# Download deb
    2.39 +FILE=$(basename $URL)
    2.40 +wget $URL
    2.41 +
    2.42 +if [ ! -f $FILE ]; then
    2.43 +	cd $CUR_DIR
    2.44 +	rm -rf $TMP_DIR
    2.45 +	echo "Could not download $FILE from $URL. Exiting."
    2.46 +	exit 1
    2.47 +fi
    2.48 +
    2.49 +XCAS_BASE=/usr/local
    2.50 +mkdir -p $PACKAGE/fs$XCAS_BASE $PACKAGE/fs/usr/bin
    2.51 +tar xzf $FILE -C $PACKAGE/fs$XCAS_BASE || true
    2.52 +# extracted pkg can be removed: Save RAM
    2.53 +rm -f $FILE
    2.54 +
    2.55 +cat > $PACKAGE/fs/usr/bin/$PACKAGE << EOT
    2.56 +#!/bin/sh
    2.57 +
    2.58 +export LD_LIBRARY_PATH=$XCAS_BASE/lib:/lib:/usr/lib
    2.59 +export XCAS_HELP=$XCAS_BASE/share/giac
    2.60 +export XCAS_ROOT=$XCAS_BASE/bin
    2.61 +\$XCAS_ROOT/xcas \$@
    2.62 +EOT
    2.63 +chmod +x $PACKAGE/fs/usr/bin/$PACKAGE 
    2.64 +
    2.65 +VERSION="$(sed '/^VERSION/!d;s/.*= //' \
    2.66 +	$PACKAGE/fs$XCAS_BASE/share/giac/examples/Exemples/Makefile)"
    2.67 +
    2.68 +mv $PACKAGE $PACKAGE-$VERSION
    2.69 +cd $PACKAGE-$VERSION/fs
    2.70 +
    2.71 +# Create menu
    2.72 +mkdir -p usr/share/applications
    2.73 +cat > usr/share/applications/xcas.desktop <<EOT
    2.74 +[Desktop Entry]
    2.75 +Version=1.0
    2.76 +Encoding=UTF-8
    2.77 +Name=Xcas
    2.78 +Exec=xcas
    2.79 +Terminal=false
    2.80 +Categories=Application
    2.81 +Icon=$XCAS_BASE/share/giac//doc/en/tutoriel/img8.png
    2.82 +Comment=Computer algebra system
    2.83 +Type=Application
    2.84 +Categories=Office;
    2.85 +EOT
    2.86 +cd ../..
    2.87 +
    2.88 +cat > $PACKAGE-$VERSION/receipt <<EOT
    2.89 +PACKAGE="$PACKAGE"
    2.90 +VERSION="$VERSION"
    2.91 +CATEGORY="$CATEGORY"
    2.92 +SHORT_DESC="$SHORT_DESC"
    2.93 +MAINTAINER="$MAINTAINER"
    2.94 +DEPENDS="$DEPENDS"
    2.95 +WEB_SITE="$WEB_SITE"
    2.96 +EOT
    2.97 +
    2.98 +# Pack
    2.99 +tazpkg pack $PACKAGE-$VERSION
   2.100 +
   2.101 +# Clean to save RAM memory
   2.102 +rm -rf $PACKAGE-$VERSION
   2.103 +
   2.104 +# Install pseudo package
   2.105 +tazpkg install $PACKAGE-$VERSION.tazpkg --root=$ROOT
   2.106 +case " $@ " in
   2.107 +*\ --k*) mv $PACKAGE-$VERSION.tazpkg $CUR_DIR ;;
   2.108 +esac
   2.109 +
   2.110 +# Clean
   2.111 +cd $CUR_DIR
   2.112 +rm -rf $TMP_DIR
   2.113 +