academic/octave-forge: Added to 12.1 repository

This commit is contained in:
Mauro Giachero 2010-05-11 22:53:06 +02:00 committed by David Somero
parent 11c6051505
commit 61e97967e7
7 changed files with 1596 additions and 0 deletions

View file

@ -0,0 +1,25 @@
This is a script to package Octave-Forge, the main source for
out-of-mainline Octave packages.
The Octave-Forge packages are grouped into four categories (main,
extra, language and nonfree). By default the script packages all of
them, but you can specify a different behavior with the REPOS
variable. For example,
REPOS=main,extra ./octave-forge.SlackBuild
will build only the "main" and "extra" repositories.
Parallel compilation (JOBS=...) is not supported.
If you want to build a newer version of Octave-Forge, you need to
regenerate the Octave script that performs the build itself. To do
this, run generate-installscript.sh after updating the usual variables
near the beginning.
This script requires Octave, available on SlackBuilds.org.
Some packages also have dependencies on external components, not
available on stock Slackware or SlackBuilds.org. These components
(and, more generally, packages failing compilation) are automatically
excluded from the package.
Note: on package removal, you should run as root:
mkdir -p /usr/share/octave/packages && \
octave --silent --eval "pkg rebuild"

View file

@ -0,0 +1 @@
octave --silent --eval "pkg rebuild"

View file

@ -0,0 +1,155 @@
#!/bin/sh
# Generate Octave script to install Octave-Forge packages respecting
# dependency constraints.
# The generated script must be run after setting:
# - main,extra,language,nonfree flags of enabled repositories to 1
# - pkg_prefix=$PKG
# Copyright 2008 Mauro Giachero
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=octave-forge
VERSION=bundle-20080507
TMP=${TMP:-/tmp/SBo}
CWD=$(pwd)
INSTALLSCRIPT=${INSTALLSCRIPT:-installscript.m}
set -e
mkdir -p $TMP
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
EXIT_STATUS=0
REPOS=$(ls --indicator-style=none)
# Build packages list
pkgs_path=$(find . -name \*.gz)
pkgs_count=$(echo $pkgs_path |tr " " "\n" |wc -l)
pkgs_sort_path=
pkgs_sort_count=0
# Extract dependency information from packages
for pkg_path in $pkgs_path; do
pkg_name=$(basename $pkg_path |cut -d "-" -f 1)
tar xfO $pkg_path --wildcards \*/DESCRIPTION |grep "Depends:" |tr "," "\n" |grep -v "Depends:" |cut -d " " -f 2 >DEPS-$pkg_name
done
# Generate Octave installation script
# Heading
for repo in $REPOS; do
# For each repository set the default value for the selection flag
echo "try $repo; catch $repo=0; end" >>$INSTALLSCRIPT
done
for pkg_path in $pkgs_path; do
# For each package, define an homonym flag to keep track of the
# successfully installed (built) packages.
echo $(basename $pkg_path |cut -d "-" -f 1)=0";" >>$INSTALLSCRIPT
done
# Create 3 files with the build results for the packages:
# - installed.tmp tracks successfully built packages;
# - broken.tmp tracks packages with build errors;
# - skipped.tmp tracks packages skipped due to missing prerequisites.
cat <<EOF >>$INSTALLSCRIPT
installed=fopen('installed.tmp','w');
skipped=fopen('skipped.tmp','w');
broken=fopen('broken.tmp','w');
EOF
# Set the packages files/folders properly.
cat <<EOF >>$INSTALLSCRIPT
oldcwd=pwd;
cd(pkg_prefix);
pkg prefix ./usr/share/octave/packages ./usr/libexec/octave/packages ;
pkg local_list ./ll
pkg global_list ./gl
cd(oldcwd);
EOF
# Resolve dependencies.
BROKEN=0 # Detect broken dependency tree
while [ $pkgs_sort_count -ne $pkgs_count ] ; do # Some packages still to sort
BROKEN=1
for pkg_path in $pkgs_path; do
if echo $pkgs_sort_path | grep -qvw $pkg_path; then # Not already in the sorted list
RESOLVED=1
pkg_name=$(basename $pkg_path |cut -d "-" -f 1)
# "ifclause" is the install condition, to avoid trying to
# install packages when their prerequisites fail.
ifclause=
for dep in $(cat DEPS-$pkg_name); do
ifclause="$dep==1 && $ifclause"
if echo $pkgs_sort_path | grep -qvw $dep; then
# Still missing some dependency
RESOLVED=0
fi
done
if [ $RESOLVED -eq 1 ]; then
pkg_repository=$(echo $pkg_path |cut -d "/" -f 2)
ifclause="$ifclause $pkg_repository==1"
pkgs_sort_path="$pkgs_sort_path $pkg_path"
pkgs_sort_count=$(($pkgs_sort_count+1))
#Output install command
cat <<EOF >>$INSTALLSCRIPT
if $ifclause
fprintf('%s','Building $pkg_name ($pkg_repository) [$pkgs_sort_count/$pkgs_count]... ')
try
pkg install $pkg_path
$pkg_name=1;
fid=installed;
fprintf('done.\n')
catch
fprintf('\n%s\n','Build of $pkg_name aborted due to errors.')
fid=broken;
end
else
disp('Skipping $pkg_name ($pkg_repository) [$pkgs_sort_count/$pkgs_count].')
fid=skipped;
end
fprintf(fid,'%s\n','$pkg_name');
EOF
# New dependency resolved, so the repository (still) looks ok
BROKEN=0
fi
fi
done
if [ $BROKEN -eq 1 ]; then
#A whole loop completed without resolving any dependency
echo "Error: broken dependency tree (some dependencies could not be resolved)" >&2
EXIT_STATUS=1
break
fi
done
# Script tail
cat <<EOF >>$INSTALLSCRIPT
fclose(installed);
fclose(skipped);
fclose(broken);
EOF
mv $INSTALLSCRIPT $CWD
# Remove temporary files
rm -f DEPS-*
exit $EXIT_STATUS

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,131 @@
#!/bin/sh
# Slackware build script for Octave-Forge
# Written by Mauro Giachero (mauro dot giachero at gmail dot com)
# Copyright 2008 Mauro Giachero
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# There are some caveats related to this script:
# - Even setting ARCH=i486, the binary parts of the packages are put
# in directories named `uname -m`-*. This is just cosmetic, as ARCH
# is actually used to set compiler flags and you really get i486
# binaries.
# - On package removal, you should run as root:
# mkdir -p /usr/share/octave/packages && octave --silent --eval "pkg rebuild"
# or Octave will be left in an incorrect state.
# - No JOBS support.
PRGNAM=octave-forge
VERSION=bundle-20080507
ARCH=${ARCH:-i486}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686 -fno-strict-aliasing"
SLKPICFLAG="-fPIC"
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686 -fno-strict-aliasing"
SLKPICFLAG="-fPIC"
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fno-strict-aliasing"
SLKPICFLAG="-fPIC"
fi
# The Octave-Forge packages are divided into four repositories.
# By default this script builds all packages from all repositories,
# but you can explicitly set which repositories you are interested in.
REPOS=${REPOS:-"main,extra,language,nonfree"}
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
-exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
# Prepare the build
( cd $PKG
mkdir -p usr/share/octave/packages
mkdir -p usr/libexec/octave/packages
)
# Compile the application and install it into the $PKG directory
CFLAGS=$SLKCFLAGS \
CXXFLAGS=$SLKCFLAGS \
FFLAGS=$SLKCFLAGS \
CPICFLAG=$SLKPICFLAG \
CXXPICFLAG=$SLKPICFLAG \
FPICFLAG=$SLKPICFLAG \
octave --silent \
--eval "pkg_prefix='$PKG';$(echo $REPOS, |sed "s/,/=1;/g")" \
$CWD/installscript.m
# Remove package registers (we don't want these in the package)
( cd $PKG
rm ll gl
)
( cd $PKG
find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
)
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
cat $CWD/generate-installscript.sh > $PKG/usr/doc/$PRGNAM-$VERSION/generate-installscript.sh
cat $CWD/installscript.m > $PKG/usr/doc/$PRGNAM-$VERSION/installscript.m
mkdir -p $PKG/install
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cat $CWD/slack-desc > $PKG/install/slack-desc
( cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$(echo $VERSION |tr - _)-$ARCH-$BUILD$TAG.tgz
)
# Print a brief compilation report
# This is useful to let the packager know which packages were
# really built (the script has to assume some failures).
echo "*** Compilation report ***"
for i in `cat installed.tmp`; do
echo "$i[ OK ]"
done
for i in `cat skipped.tmp`; do
echo "$i[ SKIP ]"
done
for i in `cat broken.tmp`; do
echo "$i[ ERROR ]"
done
echo "Package creation complete."

View file

@ -0,0 +1,8 @@
PRGNAM="octave-forge"
VERSION="bundle-20080507"
HOMEPAGE="http://octave.sourceforge.net"
DOWNLOAD="http://switch.dl.sourceforge.net/sourceforge/octave/octave-forge-bundle-20080507.tar.gz"
MD5SUM="ef7cb19e8b18281f09ad2501f6861f03"
MAINTAINER="Mauro Giachero"
EMAIL="mauro dot giachero at gmail dot com"
APPROVED="David Somero"

View file

@ -0,0 +1,19 @@
# 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 ':'.
|-----handy-ruler------------------------------------------------------|
octave-forge: Octave-Forge (Extra packages for GNU Octave)
octave-forge:
octave-forge: Octave-Forge is a central location for the collaborative development
octave-forge: of packages for GNU Octave.
octave-forge: This package contains a collection of pre-built Octave-Forge
octave-forge: packages.
octave-forge:
octave-forge: Homepage: http://octave.sourceforge.net
octave-forge:
octave-forge:
octave-forge: