Skip to content

Commit

Permalink
tig: rebuilt
Browse files Browse the repository at this point in the history
  • Loading branch information
conraid committed Mar 1, 2015
1 parent b43990d commit 0d5180a
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 70 deletions.
21 changes: 11 additions & 10 deletions tig/doinst.sh
@@ -1,14 +1,15 @@
config() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
# If there's no config file by that name, mv it over:
if [ ! -r $OLD ]; then
mv $NEW $OLD
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
# toss the redundant copy
rm $NEW
fi
# Otherwise, we leave the .new copy for the admin to consider...
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
# If there's no config file by that name, mv it over:
if [ ! -r $OLD ]; then
mv $NEW $OLD
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
# toss the redundant copy
rm $NEW
fi
# Otherwise, we leave the .new copy for the admin to consider...
}


config etc/tigrc.new
14 changes: 7 additions & 7 deletions tig/slack-desc
@@ -1,17 +1,17 @@
# 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
# 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 ':' except on otherwise blank lines.

|-----handy-ruler------------------------------------------------------|
tig: tig (git interface)
tig: tig (git ncurses interface)
tig:
tig: Tig is an ncurses-based text-mode interface for git.
tig: It functions mainly as a Git repository browser, but can also assist
tig: in staging changes for commit at chunk level and act as a pager for
tig: output from various Git commands.
tig: in staging changes for commit at chunk level and act as a pager
tig: for output from various Git commands.
tig:
tig:
tig:
Expand Down
106 changes: 53 additions & 53 deletions tig/tig.SlackBuild
Expand Up @@ -2,7 +2,7 @@
#
# Slackware build script for tig
#
# Copyright 2014 Corrado Franco (http://conraid.net)
# Copyright 2015 Corrado Franco (http://conraid.net)
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
Expand All @@ -25,73 +25,70 @@
# Latest version of this SlackBuild at http://slackers.it/repository

# Exit on most errors
set -e
set -eu

# Set variables:
CWD=$(pwd)

PRGNAME=${PRGNAME:-tig}
PKGNAME=$(echo $PRGNAME | tr A-Z a-z)
PKGNAME=$(echo ${PRGNAME} | tr A-Z a-z)
VERSION=${VERSION:-2.0.3}
PKGVERSION=$(echo $VERSION | tr - _)
BUILD=${BUILD:-1}
PKGVERSION=$(echo ${VERSION} | tr - _)
BUILD=${BUILD:-2}
TAG=${TAG:-cf}
TMP=${TMP:-/tmp/pkg}
PKG=$TMP/package-$PKGNAME
DOCS="$PKG/usr/doc/$PKGNAME-$PKGVERSION"
PKG=${TMP}/package-${PKGNAME}
DOCDIR="${PKG}/usr/doc/${PKGNAME}-${PKGVERSION}"

# Insert document files in this variable
DOCFILES="COPYING"

ARCH=${ARCH:=""} # Set ARCH or leave blank to determine it automatically
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
if [ -z ${ARCH:=""} ]; then
case "$( uname -m )" in
i?86) ARCH=i686 ;;
arm*) ARCH=arm ;;
# Unless $ARCH is already set, use uname -m for all other archs:
*) ARCH=$( uname -m ) ;;
i?86) ARCH=i686 ;;
arm*) ARCH=arm ;;
# Unless $ARCH is already set, use uname -m for all other archs:
*) ARCH=$( uname -m ) ;;
esac
fi

# Set compiling FLAGS
case "$ARCH" in
i[3-5]86)
SLKCFLAGS="-O2 -march=${ARCH} -mtune=i686"; CHOST="i486"
i[3-5]86)
SLKCFLAGS="-O2 -march=${ARCH} -mtune=i686"; CHOST="i486"
SLKLDFLAGS=""; LIBDIRSUFFIX=""
;;
i686)
;;
i686)
SLKCFLAGS="-O2 -march=i686 -pipe -fomit-frame-pointer"; CHOST="i486"
SLKLDFLAGS=""; LIBDIRSUFFIX=""
;;
x86_64)
;;
x86_64)
SLKCFLAGS="-O2 -fPIC -pipe -fomit-frame-pointer"; CHOST="x86_64"
SLKLDFLAGS="-L/lib64 -L/usr/lib64"; LIBDIRSUFFIX="64"
;;
*)
;;
*)
SLKCFLAGS="-O2"; CHOST=$ARCH
SLKLDFLAGS=""; LIBDIRSUFFIX=""
;;
esac

# Extract source and prepare:
rm -rf $PKG
mkdir -p $TMP $PKG
cd $TMP
rm -rf $PRGNAME-$VERSION
tar xvf $CWD/$PRGNAME-$VERSION.tar.gz
cd $PRGNAME-$VERSION

rm -rf ${PKG}
mkdir -p ${TMP} ${PKG}
cd ${TMP}
rm -rf ${PRGNAME}-${VERSION}
tar xvf ${CWD}/${PRGNAME}-${VERSION}.tar.gz
cd ${PRGNAME}-${VERSION}

# Make sure ownerships and permissions are sane:
chown -R root:root .
chmod -R u+w,go+r-w,a-s .

# Configure
sed -i 's|$(docdir)/tig|$(docdir)|' Makefile
LDFLAGS="$SLKLDFLAGS" \
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
LDFLAGS="${SLKLDFLAGS}" \
CFLAGS="${SLKCFLAGS}" \
CXXFLAGS="${SLKCFLAGS}" \
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
Expand All @@ -100,39 +97,42 @@ CXXFLAGS="$SLKCFLAGS" \
--mandir=/usr/man \
--infodir=/usr/info \
--docdir=/usr/doc/${PKGNAME}-${PKGVERSION} \
--host=$CHOST-slackware-linux \
--build=$CHOST-slackware-linux
--host=${CHOST}-slackware-linux \
--build=${CHOST}-slackware-linux

# Build and install:
make
make DESTDIR=$PKG install install-doc

# Install bash completion file.
install -Dm644 contrib/tig-completion.bash $PKG/etc/bash_completion.d/tig

# Rename config file
mv $PKG/etc/tigrc $PKG/etc/tigrc.new
make DESTDIR=${PKG} install install-doc

# Strip binaries:
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF | cut -f 1 -d : | xargs -r strip --strip-unneeded 2> /dev/null || true
find $PKG | xargs file | grep "current ar archive" | cut -f 1 -d : | xargs -r strip -g 2> /dev/null || true

find ${PKG} | xargs file | grep -e "executable" -e "shared object" | grep ELF | cut -f 1 -d : | xargs -r strip --strip-unneeded 2> /dev/null || true
find ${PKG} | xargs file | grep "current ar archive" | cut -f 1 -d : | xargs -r strip -g 2> /dev/null || true

# Compress and link manpages, if any:
if [ -d $PKG/usr/man ]; then
find $PKG/usr/man -type f -exec gzip -9 {} \;
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
if [ -d ${PKG}/usr/man ]; then
find ${PKG}/usr/man -type f -exec gzip -9 {} \;
for i in $( find ${PKG}/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
fi

# Add bash completion file
install -Dm644 contrib/tig-completion.bash $PKG/etc/bash_completion.d/tig

# Rename config file
mv $PKG/etc/tigrc $PKG/etc/tigrc.new

# Add a documentation directory:
mkdir -p ${DOCS}
cp -a $DOCFILES $DOCS
mkdir -p ${DOCDIR}
cp -a ${DOCFILES} ${DOCDIR} || true

# Add a slackbuild script:
install -Dm644 $CWD/$PKGNAME.SlackBuild $DOCS/$PKGNAME.SlackBuild
install -Dm644 ${CWD}/${PKGNAME}.SlackBuild ${DOCDIR}/${PKGNAME}.SlackBuild

# Add slack-desc
install -Dm644 $CWD/slack-desc $PKG/install/slack-desc
install -Dm644 ${CWD}/slack-desc ${PKG}/install/slack-desc

# Add a doinst.sh
install -Dm644 ${CWD}/doinst.sh ${PKG}/install/doinst.sh

# Create package:
cd $PKG
/sbin/makepkg -l y -c n $CWD/$PKGNAME-$PKGVERSION-$ARCH-${BUILD}${TAG}.txz
cd ${PKG}
/sbin/makepkg -l y -c n ${CWD}/${PKGNAME}-${PKGVERSION}-${ARCH}-${BUILD}${TAG}.txz

0 comments on commit 0d5180a

Please sign in to comment.