development/shc: Updated for version 3.9.6, new maintainer.

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
Giuseppe Di Terlizzi 2017-07-11 20:59:48 +07:00 committed by Willy Sudiarto Raharjo
parent df40e05546
commit b88d2f57f0
4 changed files with 67 additions and 40 deletions

View file

@ -1,8 +1,15 @@
SHC takes a script, which is specified on the command line and
produces C source code. The generated source code is then compiled
and linked to produce a stripped binary executable.
shc - Shell script compiler
Use with care.
SHC is a generic shell script compiler. It takes a script, which is specified on
the command line and produces C source code. The generated source code is then
compiled and linked to produce a stripped binary.
After installation, try it with
shc -v -r -T -f myscript
The compiled binary will still be dependent on the shell specified in the first
line of the shell code (i.e shebang: #!/bin/sh or such), thus shc does not
create completely independent binaries.
shc itself is not a compiler such as cc, it rather encodes and encrypts a shell
script and generates C source code with the added expiration capability. It then
uses the system compiler to compile a stripped binary which behaves exactly like
the original script. Upon execution, the compiled binary will decrypt and
execute the code with the shells' -c option.

View file

@ -1,10 +1,30 @@
#!/bin/sh
# Slackware build script for shc script compiler
# Updated for Slackware by Roberto Metere <roberto <at> metere <dot> it>
# Slackware build script for shc
# Previously maintained by Roberto Metere <roberto <at> metere <dot> it>
# Copyright 2017 Giuseppe Di Terlizzi <giuseppe.diterlizzi@gmail.com>
# 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=shc
VERSION=${VERSION:-3.8.7}
VERSION=${VERSION:-3.9.6}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
@ -24,10 +44,10 @@ OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
@ -41,37 +61,37 @@ rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.t*
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
# patch Makefile to respect CFLAGS
sed -i "s/CFLAGS =/CFLAGS +=/" Makefile
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--sysconfdir=/etc \
--localstatedir=/var \
--mandir=/usr/man \
--docdir=/usr/doc/$PRGNAM-$VERSION \
--build=$ARCH-slackware-linux
make CFLAGS="$SLKCFLAGS"
make
make install DESTDIR=$PKG
# avoid make install errors
mkdir -p $PKG/usr/bin
mkdir -p $PKG/usr/man/man1
echo yes > yes
make \
INSTALL_PATH="$PKG/usr" \
install < yes
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
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
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/
cp -a shc.README CHANGES Copying shc.html $PKG/usr/doc/$PRGNAM-$VERSION
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a README README.md AUTHORS COPYING ChangeLog $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install

View file

@ -1,10 +1,10 @@
PRGNAM="shc"
VERSION="3.8.7"
HOMEPAGE="http://www.datsi.fi.upm.es/~frosal/"
DOWNLOAD="http://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.7.tgz"
MD5SUM="6057436b4f00b2e0dbf5d364263d822e"
VERSION="3.9.6"
HOMEPAGE="http://neurobin.github.io/shc"
DOWNLOAD="https://github.com/neurobin/shc/archive/3.9.6/shc-3.9.6.tar.gz"
MD5SUM="da777637594be58caf33509d2ca0fbea"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES=""
MAINTAINER="Roberto Metere"
EMAIL="roberto@metere.it"
MAINTAINER="Giuseppe Di Terlizzi"
EMAIL="giuseppe.diterlizzi@gmail.com"

View file

@ -6,14 +6,14 @@
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
shc: shc (generic SHell script Compiler)
shc:
shc: shc creates a stripped binary executable version of the
shc: script specified with -f on the command line.
shc:
shc: Homepage: http://www.datsi.fi.upm.es/~frosal/
shc: shc (Shell script compiler)
shc:
shc: SHC is a generic shell script compiler. It takes a script, which is
shc: specified on the command line and produces C source code.
shc: The generated source code is then compiled and linked to produce
shc: a stripped binary.
shc:
shc:
shc:
shc: Home Page: http://neurobin.github.io/shc
shc: