From 79245abc0c95ce44786f9ca6f954858d9f6501c8 Mon Sep 17 00:00:00 2001 From: rudson Date: Fri, 14 Dec 2007 14:28:45 +0000 Subject: git-svn-id: svn+slack://slack.fluxo.info/var/svn/slackbuilds@1533 370017ae-e619-0410-ac65-c121f96126d4 --- sci/mathematics/octave/octave.SlackBuild | 13 +- sci/mathematics/scilab/scilab.SlackBuild | 258 ++++++++++++++----------------- sci/mathematics/scilab/slack-required | 4 + 3 files changed, 125 insertions(+), 150 deletions(-) create mode 100644 sci/mathematics/scilab/slack-required (limited to 'sci') diff --git a/sci/mathematics/octave/octave.SlackBuild b/sci/mathematics/octave/octave.SlackBuild index d0e993b4..da7abf85 100644 --- a/sci/mathematics/octave/octave.SlackBuild +++ b/sci/mathematics/octave/octave.SlackBuild @@ -15,7 +15,7 @@ # Place - Suite 330, Boston, MA 02111-1307, USA # # slackbuild for octave, by Rudson R. Alves -# requires: gcc flex bison gperf +# requires: gcc flex bison gperf # tested: octave-2.9.13 # @@ -66,7 +66,7 @@ ERROR_TAR=37; ERROR_MKPKG=38; ERROR_GPG=39 ERROR_PATCH=40; ERROR_VCS=41; ERROR_MKDIR=42 # Clean up any leftovers of previous builds -rm -rf "$PKG_SRC" 2> /dev/null +rm -rf "$PKG_WORK" 2> /dev/null rm -rf "$PKG" 2> /dev/null # Create directories if necessary @@ -83,7 +83,6 @@ if [ ! -s "$SRC_DIR/$SRC" ] || ! bunzip2 -t "$SRC_DIR/$SRC" 2> /dev/null; then wget "$URL" -O "$SRC_DIR/$SRC" || exit $ERROR_WGET fi - # Untar cd "$PKG_WORK" tar --no-same-owner --no-same-permissions -xvf "$SRC_DIR/$SRC" || exit $ERROR_TAR @@ -113,7 +112,11 @@ make install DESTDIR="$PKG" || exit $ERROR_INSTALL # Install documentation DOCS="NEWS TODO README AUTHORS INSTALL ChangeLog MAINTAINERS COPYING readme.*" mkdir -p "$PKG/usr/doc/$PKG_NAME-$PKG_VERSION" || exit $ERROR_MKDIR -cp -a $DOCS "$PKG/usr/doc/$PKG_NAME-$PKG_VERSION" +for doc in $DOCS; do + if [ -f "$doc" ]; then + cp -a $doc "$PKG/usr/doc/$PKG_NAME-$PKG_VERSION" + fi +done # Add package description (slack-desc) mkdir -p "$PKG/install" || exit $ERROR_MKDIR @@ -145,5 +148,5 @@ makepkg -l y -c n "$REPOS/$PKG_NAME-$PKG_VERSION-$ARCH-$BUILD.tgz" || exit $ERRO # Delete source and build directories if requested if [ "$CLEANUP" == "yes" ]; then - rm -rf "$PKG_SRC" "$PKG" + rm -rf "$PKG_WORK" "$PKG" fi diff --git a/sci/mathematics/scilab/scilab.SlackBuild b/sci/mathematics/scilab/scilab.SlackBuild index f32e7153..7068380f 100755 --- a/sci/mathematics/scilab/scilab.SlackBuild +++ b/sci/mathematics/scilab/scilab.SlackBuild @@ -1,159 +1,122 @@ #!/bin/bash # -# scilab.SlackBuild is free software; you can redistribute it and/or modify it under the -# terms of the GNU General Public License as published by the Free Software -# Foundation; either version 2 of the License, or any later version. +# scilab.SlackBuild is free software; you can redistribute +# it and/or modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the License, +# or any later version. # -# scilab.SlackBuild is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR -# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# scilab.SlackBuild is distributed in the hope that it will +# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., 59 Temple # Place - Suite 330, Boston, MA 02111-1307, USA # -# slackbuild for lame, by Rudson R. Alves -# requires: none -# tested: scilab-4.1 - -CWD=`pwd` +# slackbuild for scilab, by Rudson R. Alves +# requires: gtk+2 +# tested: scilab-4.1.2 +# -if [ -e ~/.slackbuildrc ]; then +# Look for slackbuildrc +if [ -f ~/.slackbuildrc ]; then source ~/.slackbuildrc -elif [ -e /etc/slackbuildrc ]; then +elif [ -f /etc/slackbuildrc ]; then source /etc/slackbuildrc fi -# -------- Variáveis de controle de versão -------------- -# Nome da fonte para a qual o slackbuild foi construído e -# o seu md5sum -SRC_ORIG="scilab-4.1-src.tar.gz" -MD5_ORIG="3003fe63088558b931a11127fb8d8ccc" -PACKAGE_ORIG=`echo $SRC_ORIG | sed -r 's/(.*)-(.*)-src\.(.*\..*)$/\1/'` -VERSION_ORIG=`echo $SRC_ORIG | sed -r 's/(.*)-(.*)-src\.(.*\..*)$/\2/'` - EXTENSION=`echo $SRC_ORIG | sed -r 's/(.*)-(.*)-src\.(.*\..*)$/\3/'` - -# ------- Códigos de erro para o createpkg -------------- -ERROR_WGET=31; ERROR_MAKE=32; ERROR_INSTALL=33 -ERROR_MD5=34; ERROR_CONF=35; ERROR_HELP=36 -ERROR_TAR=37; ERROR_MKPKG=38; ERROR_GPG=39 -ERROR_PATCH=40; ERROR_VCS=41 - -# --------- Inicializa variáveis de entrada ------------- -PACKAGE=$PACKAGE_ORIG +# Set variables +CWD="$(pwd)" +SRC_NAME="scilab" +PKG_NAME="scilab" ARCH=${ARCH:=i486} -SRC_DIR=${SRC:=$CWD} -VERSION=${VERSION:=$VERSION_ORIG} -SRC=$PACKAGE-$VERSION-src.$EXTENSION -BUILD=${BUILD:=1rud} +SRC_VERSION=${VERSION:=4.1.2} +PKG_VERSION="$(echo "$SRC_VERSION" | tr '[[:blank:]-]' '_')" +BUILD=${BUILD:=1rra} +SRC_DIR=${SRC_DIR:=$CWD}/$PKG_NAME TMP=${TMP:=/tmp} +PKG=${PKG:=$TMP/package-$PKG_NAME} REPOS=${REPOS:=$TMP} PREFIX=${PREFIX:=/usr} -OPTCONF=${OPTCONF:=""} -MD5=${MD5:=$MD5_ORIG} -URL=${URL:="http://www.scilab.org/download/4.1/$SRC"} - -# ---------------- Download fontes ---------------------- -# Fonte a ser compilada, com o path -SOURCE=$SRC_DIR/$PACKAGE/$SRC -# Verifica existência do pacote em $SRC em $SRC_DIR -if [ ! -e $SOURCE ]; then - wget "$URL" -P "$SRC_DIR/$PACKAGE/" || exit $ERROR_WGET -fi +PKG_WORK="$TMP/$SRC_NAME" +CONF_OPTIONS=${CONF_OPTIONS:="--with-gfortran --prefix=/usr --with-tcl-library=/usr/lib64"} +NUMJOBS=${NUMJOBS:="-j4"} -# ------------------ Checa md5sum ----------------------- -if [ "$SRC_ORIG" = "$SRC" -o "$MD5" != "$MD5_ORIG" -a "$MD5" != "no" ]; then - SUM=`md5sum $SOURCE | awk '{print $1}'` - [ "$SUM" != "$MD5" ] && exit $ERROR_MD5 -fi +# Set system libraries' path and optmization flags based on $ARCH +LIBDIR="$PREFIX/lib" -# ----------------- ARCH e LIBDIR ----------------------- -# Libdir, para arch x86_64 -LIBDIR=$PREFIX/lib -# Seleciona flags para o compilador if [ "$ARCH" = "i386" ]; then - SLKCFLAGS="-O2 -march=i386 -mcpu=i686" + SLKCFLAGS="-O2 -march=i386 -mcpu=i686" elif [ "$ARCH" = "i486" ]; then - SLKCFLAGS="-O2 -march=i486 -mcpu=i686" + SLKCFLAGS="-O2 -march=i486 -mcpu=i686" elif [ "$ARCH" = "i686" ]; then - SLKCFLAGS="-O2 -march=i686" + SLKCFLAGS="-O2 -march=i686" elif [ "$ARCH" = "s390" ]; then - SLKCFLAGS="-O2" + SLKCFLAGS="-O2" elif [ "$ARCH" = "x86_64" ]; then - SLKCFLAGS="-O2" - LIBDIR="$PREFIX/lib64" + SLKCFLAGS="-O2" + LIBDIR="$PREFIX/lib64" fi -# -------------- Desempacota fontes --------------------- -# Desempacota fontes em $TMP/$PACKAGE-source -PKG_SRC=$TMP/$PACKAGE-source -rm -rf $PKG_SRC 2>/dev/null -mkdir -p $PKG_SRC -# Desempacota $SOURCE em $TMP/$PACKAGE-source -tar xvf $SOURCE -C $PKG_SRC || exit $ERROR_TAR +# Set error codes (used by createpkg) +ERROR_WGET=31; ERROR_MAKE=32; ERROR_INSTALL=33 +ERROR_MD5=34; ERROR_CONF=35; ERROR_HELP=36 +ERROR_TAR=37; ERROR_MKPKG=38; ERROR_GPG=39 +ERROR_PATCH=40; ERROR_VCS=41; ERROR_MKDIR=42 + +# Clean up any leftovers of previous builds +rm -rf "$PKG_WORK" 2> /dev/null +rm -rf "$PKG" 2> /dev/null + +# Create directories if necessary +mkdir -p "$SRC_DIR" || exit $ERROR_MKDIR +mkdir -p "$PKG" || exit $ERROR_MKDIR +mkdir -p "$REPOS" || exit $ERROR_MKDIR +mkdir -p "$PKG_WORK" || exit $ERROR_MKDIR + +# Dowload source if necessary +SRC="$SRC_NAME-$VERSION-src.tar.gz" +URL="http://www.scilab.org/download/$VERSION/$SRC" -# Pega o nome do diretório das fontes independente de sua -# estrutura (package-version...) -PKG_DIR="$PKG_SRC/$( ls $PKG_SRC/ )" -cd $PKG_DIR +if [ ! -s "$SRC_DIR/$SRC" ] || ! gunzip -t "$SRC_DIR/$SRC" 2> /dev/null; then + wget "$URL" -O "$SRC_DIR/$SRC" || exit $ERROR_WGET +fi + +# Untar +cd "$PKG_WORK" +tar --no-same-owner --no-same-permissions -xvf "$SRC_DIR/$SRC" || exit $ERROR_TAR +PKG_SRC=`ls -l | awk '/^d/ { print $8 }'` +cd "$PKG_SRC" -# -------------- Configura programa --------------------- -# Configura programa -CFLAGS="$SLKCFLAGS" ./configure --prefix=$PREFIX --libdir=$LIBDIR $OPTCONF || exit $ERROR_CONF +# Configure +CFLAGS="$SLKCFLAGS" \ + CXXFLAGS="$SLKCFLAGS" \ + ./configure \ + --prefix="$PREFIX" --libdir="$LIBDIR" $CONF_OPTIONS || exit $ERROR_CONF -# ---------------- Compila programa --------------------- +# Compile make all || exit $ERROR_MAKE -# ------------- Diretório Temporário -------------------- -# Cria diretório temporário para construção do pacote -PKG=$TMP/$PACKAGE -rm -rf $PKG -mkdir -p $PKG - -# --------------- Instala programa ---------------------- -# Instala programa em diretório temporário -mkdir -p $PKG/$LIBDIR -cp -pr $PKG_SRC/* $PKG/$LIBDIR/ -rm -rf $PKG/$LIBDIR/$PACKAGE-$VERSION/Perl -rm -rf $PKG/$LIBDIR/$PACKAGE-$VERSION/Win-util -rm -rf $PKG/$LIBDIR/$PACKAGE-$VERSION/intersci -rm -rf $PKG/$LIBDIR/$PACKAGE-$VERSION/lcc -rm -rf $PKG/$LIBDIR/$PACKAGE-$VERSION/libs -rm -rf $PKG/$LIBDIR/$PACKAGE-$VERSION/m4 -rm -rf $PKG/$LIBDIR/$PACKAGE-$VERSION/ocaml - -# Refazendo links -mkdir -p $PKG/$PREFIX/bin 2>/dev/null -ln -s $LIBDIR/$PACKAGE-$VERSION/bin/intersci-n $PKG/$PREFIX/bin/intersci-n 2>/dev/null -ln -s $LIBDIR/$PACKAGE-$VERSION/bin/scilab $PKG/$PREFIX/bin/scilab 2>/dev/null -ln -s $LIBDIR/$PACKAGE-$VERSION/bin/intersci $PKG/$PREFIX/bin/intersci 2>/dev/null - -# Correção no index.html -( - cd $PKG/$LIBDIR/$PACKAGE-$VERSION/man/eng/ - eval "sed 's,${PKG_SRC},${PREFIX}/lib,g' index.htm > index.htm.new" - mv index.htm.new index.htm - cd ../fr - eval "sed 's,${PKG_SRC},${PREFIX}/lib,g' index.htm > index.htm.new" - mv index.htm.new index.htm -) +# Change intall path +eval "sed -i 's¦^PREFIX=$PREFIX¦PREFIX=$PKG/${PREFIX:1}¦' Makefile" +make install -# Correção do script scilab -( - pwd - cd $PKG/$LIBDIR/$PACKAGE-$VERSION/bin/ - eval "sed 's,^SCI=\\\".*$,SCI=\\\"/usr/lib/$PACKAGE-$VERSION\\\",' scilab > scilab.new" - cp scilab.new scilab -) +cd $PKG +for i in `grep -Rl '/tmp/package-scilab' usr/*`; do + sed -i 's:/tmp/package-scilab::g' $i +done + +cd - >/dev/null -# Cria Scilab.desktop +# Make Scilab.desktop mkdir -p $PKG/usr/share/applications/ 2>/dev/null cat << EOF_KDE > $PKG/usr/share/applications/Scilab.desktop [Desktop Entry] Encoding=UTF-8 Categories=Education;Math; Exec=scilab -Icon=/usr/lib/scilab-4.0/X11_defaults/scilab.xpm +Icon=$PREFIX/lib/$PKG_NAME-$VERSION/X11_defaults/scilab.xpm StartupNotify=true Terminal=false Type=Application @@ -161,48 +124,53 @@ Name=Scilab GenericName=Scilab Comment= EOF_KDE -# --------------------------------------------------------- -# ----------------- Stripa código ----------------------- -cd $PKG -echo -e "\n\n\033[01;32m Striping code \n\033[m" -find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2>/dev/null -find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2>/dev/null +# Strip binaries +( cd "$PKG" + find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | \ + xargs strip --strip-unneeded 2> /dev/null + find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | \ + xargs strip --strip-unneeded 2> /dev/null +) -# ---------------- Cria slack-desc ---------------------- -mkdir $PKG/install -cat << EOF > $PKG/install/slack-desc +# Install documentation +DOCS="ACKNOWLEDGEMENTS CHANGES README_Unix README_Windows.txt RELEASE_NOTES Readme_Visual.txt licence.txt license.txt release_notes.txt" +mkdir -p "$PKG/usr/doc/$PKG_NAME-$PKG_VERSION" || exit $ERROR_MKDIR +for doc in $DOCS; do + if [ -f "$doc" ]; then + cp -a $doc "$PKG/usr/doc/$PKG_NAME-$PKG_VERSION" + fi +done + +# Add package description (slack-desc) +mkdir -p "$PKG/install" || exit $ERROR_MKDIR +cat << EODESC > "$PKG/install/slack-desc" # HOW TO EDIT THIS FILE: # The "handy ruler" below makes it easier to edit a package description. Line -# up the first '|' above the ':' following the base package name, and the '|' on -# the right side marks the last column you can put a character in. You must make -# exactly 11 lines for the formatting to be correct. It's also customary to -# leave one space after the ':'. +# up the first '|' above the ':' following the base package name, and the '|' +# on the right side marks the last column you can put a character in. You must +# make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':'. - |--------handy-ruler-----------------------------------------------------| -scilab: Scilab package by Rudson R. Alves + |-----handy-ruler-------------------------------------------------------| +scilab: scilab by Slack.Sarava scilab: -scilab: Scilab is a scientific software package for numerical computations +scilab: Scilab is a scientific software package for numerical computations scilab: providing a powerful open computing enviroanment for engineering and scilab: scientific applications. Developed since 1990 by researchers from scilab: INRIA and ENPC, it is now maintained and developed by Scilab scilab: Consortium since its creation in May 2003. -scilab: Distributed freely and open source (see the license and the +scilab: Distributed freely and open source (see the license and the scilab: trademark license) via the Internet since 1994, Scilab is currently scilab: being used in educational and industrial environments around the scilab: world. -EOF - -# ----------------- Documentações ----------------------- -# Criar diretório de documentação -PKG_DOC=usr/doc/$PACKAGE-$VERSION -mkdir -p $PKG_DOC -cp $PKG_DIR/{ACKNOWLEDGEMENTS,CHANGES,README_Unix,README_Windows.txt,RELEASE_NOTES,Readme_Visual.txt,licence.txt,release_notes.txt} $PKG_DOC +EODESC -# --------------- Constroi o pacote --------------------- -makepkg -c y -l y $REPOS/$PACKAGE-$VERSION-$ARCH-$BUILD.tgz || exit $ERROR_MKPKG +# Build the package +cd "$PKG" +makepkg -l y -c n "$REPOS/$PKG_NAME-$PKG_VERSION-$ARCH-$BUILD.tgz" || exit $ERROR_MKPKG -# ----------- Remove arquivos temporários --------------- +# Delete source and build directories if requested if [ "$CLEANUP" == "yes" ]; then - rm -rf $PKG $PKG_SRC + rm -rf "$PKG_WORK" "$PKG" fi diff --git a/sci/mathematics/scilab/slack-required b/sci/mathematics/scilab/slack-required new file mode 100644 index 00000000..e8bb2098 --- /dev/null +++ b/sci/mathematics/scilab/slack-required @@ -0,0 +1,4 @@ +# Dependency list to scilab +# +# dependency [condition] [version]] +gtk+2 -- cgit v1.2.3