Some SlackBuild scripts for Slackware.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

114 lines
3.4 KiB

#!/bin/bash
# Build script for Slackware
# Damien Goutte-Gattat "gouttegd" < damien.goutte-gattat at e.ujf-grenoble.fr >
#
# Redistribution and use of this script, with or without modifications, 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.
#
# Latest ImageJ distribution is available at:
# http://rsb.info.nih.gov/ij/
# Source packages infos
IMAGEJ="ij140.zip"
IMAGEJ_URL="http://rsb.info.nih.gov/ij/download/zips/$IMAGEJ"
MBFPLUG="mbf-plugins.zip"
MBFPLUG_URL="http://rsb.info.nih.gov/ij/plugins/download/$MBF_PLUG"
LSMPLUG="LSM_Toolbox.jar"
LSMPLUG_URL="http://image-archive.org/fileadmin/user_upload/files_/$LSMPLUG"
IJDOCS="ij-docs.zip"
IJDOCS_URL="http://rsb.info.nih.gov/ij/download/docs/$IJDOCS"
# Built package infos
NAMETGZ=${NAMETGZ:-imagej}
VERSION=${VERSION:-1.40}
BUILD=${BUILD:-2GGD}
ARCH=${ARCH:-i486}
TARGET=${TARGET:-i486}
# Directories
TMP=${TMP:-/tmp}
OUT=${OUT:-$TMP/build}
PKG=${PKG:-$OUT/$NAMETGZ}
CWD=$(pwd)
set -e # Quit if a command returns non-zero
# Sanity checks
if [ $UID -eq 0 ]; then
echo "You should NOT run this script as ROOT!"
exit 1
fi
if [ ! -d $TMP ]; then
echo "$TMP does not exist or is not a directory!"
exit 1
fi
# Get and verify the archives
if [ ! -r $IMAGEJ ]; then
wget "$IMAGEJ_URL"
fi
if [ ! -r $MBFPLUG ]; then
wget "$MBFPLUG_URL"
fi
if [ ! -r $LSMPLUG ]; then
wget "$LSMPLUG_URL"
fi
if [ ! -r $IJDOCS ]; then
wget "$IJDOCS_URL"
fi
sha1sum -c sha1sums
# Install ImageJ
mkdir -p $PKG/opt
unzip -q $IMAGEJ -d $PKG/opt
rm -rf $PKG/opt/ImageJ/{ImageJ.exe,README.html,ImageJ.app,run,plugins}
# Install additional plugins
unzip -q $MBFPLUG -d $PKG/opt/ImageJ
rm -rf $PKG/opt/ImageJ/__MACOSX "$PKG/opt/ImageJ/plugins/ Help"
rm -rf $PKG/opt/ImageJ/plugins/source
cp $LSMPLUG $PKG/opt/ImageJ/plugins
# Install the documentation
unzip -q $IJDOCS -d $PKG/opt/ImageJ
mv $PKG/opt/ImageJ/ij-docs $PKG/opt/ImageJ/docs
rm -rf $PKG/opt/ImageJ/__MACOSX
# Sanitize permissions
find $PKG/opt/ImageJ -type f -print0 | xargs -0 chmod 644
find $PKG/opt/ImageJ -type d -print0 | xargs -0 chmod 755
# Copy the launching script, slack-desc, desktop and doinst.sh files
mkdir -p $PKG/usr/bin $PKG/usr/share/applications $PKG/install
install -m 755 run.sh $PKG/usr/bin/imagej
install -m 644 imagej.desktop $PKG/usr/share/applications
install -m 644 slack-desc $PKG/install/slack-desc
install -m 755 doinst.sh $PKG/install/doinst.sh
# Package the tree
cd $PKG
mkdir -p $OUT
PACKAGING="
chown root:root . -R
/sbin/makepkg -l y -c n $OUT/$NAMETGZ-$VERSION-$ARCH-$BUILD.tgz
rm -rf $PKG
"
if type -p fakeroot ; then
echo "$PACKAGING" | fakeroot
else
su -c "$PACKAGING"
fi