slackbuilds/ap/oil/SlackBuild

71 lines
1.7 KiB
Bash
Executable file

#!/bin/bash
CWD=$(pwd)
PRGNAM=$(basename $CWD)
VERSION=${VERSION:-$(curl -s "https://www.oilshell.org/download/?C=M;O=D" | grep -o "oil-[0-9].*tar.xz" | head -n1 | cut -d\> -f2 | sed 's|^oil-||' | sed 's|.tar.xz$||')}
BUILD=1
TAG=gwh
ARCH=$(uname -m)
OUTPUT=/tmp
TMP=/tmp/$TAG
PKG=$TMP/pkg-$PRGNAM
PREFIX=/usr
REPOSITORY=${REPOSITORY:-/var/cache/SlackBuilds.gwh/$PRGNAM}
mkdir -p $REPOSITORY
mkdir -p $TMP
cd $TMP
# Cleaning
rm -fr $PRGNAM-${VERSION} $PKG
# Fetching binaries
[ ! -e $REPOSITORY/${PRGNAM}-${VERSION}.tar.xz ] && wget -c https://www.oilshell.org/download/${PRGNAM}-${VERSION}.tar.xz -O $REPOSITORY/${PRGNAM}-${VERSION}.tar.xz
tar xvf $REPOSITORY/${PRGNAM}-${VERSION}.tar.xz
cd ${PRGNAM}-${VERSION}
# configuration
./configure \
--prefix=/usr \
--datarootdir=/usr
make
DESTDIR=$PKG ./install
# Cleaning
[ -d $PKG$PREFIX/man ] && find $PKG$PREFIX/man -type f -not -name \*.gz -exec gzip -9 {} \;
cd $PKG
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 {} \;
# Packaging
mkdir install
cat <<EOF > install/slack-desc
$PRGNAM: $PRGNAM (is a new Unix shell)
$PRGNAM:
$PRGNAM: Oil is a new Unix shell. It's our upgrade path from bash to a better
$PRGNAM: language and runtime. It's for Python and JavaScript users who avoid
$PRGNAM: shell!
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM: http://www.oilshell.org/
$PRGNAM:
EOF
rm -f $PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la
/sbin/makepkg --linkadd y --chown n --prepend $OUTPUT/$PRGNAM-$(echo $VERSION | tr -d '-')-$ARCH-$BUILD$TAG.txz