aboutsummaryrefslogtreecommitdiffstats
path: root/highlight
diff options
context:
space:
mode:
authorSukma Wardana <hey@swardana.com>2020-09-04 13:40:00 +0700
committerSukma Wardana <hey@swardana.com>2020-09-04 13:40:00 +0700
commitd5b7c5768bae8a736afea472b5b00f9fa999c843 (patch)
tree266d2b5fa09751dfa5e24fc3df10350cd46c5dee /highlight
parentf2c2b2df62c6b4fc87a7044b4d7bf6b9538d95af (diff)
downloadslackbuilds-d5b7c5768bae8a736afea472b5b00f9fa999c843.tar.gz
slackbuilds-d5b7c5768bae8a736afea472b5b00f9fa999c843.zip
Add Slackware packages for highlight 3
Signed-off-by: Sukma Wardana <hey@swardana.com>
Diffstat (limited to 'highlight')
-rw-r--r--highlight/doinst.sh14
-rw-r--r--highlight/highlight.SlackBuild204
-rw-r--r--highlight/highlight.info10
-rw-r--r--highlight/slack-desc19
-rw-r--r--highlight/slack-required1
5 files changed, 248 insertions, 0 deletions
diff --git a/highlight/doinst.sh b/highlight/doinst.sh
new file mode 100644
index 0000000..3aa4c17
--- /dev/null
+++ b/highlight/doinst.sh
@@ -0,0 +1,14 @@
+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...
+}
+
+config etc/highlight/filetypes.conf.new \ No newline at end of file
diff --git a/highlight/highlight.SlackBuild b/highlight/highlight.SlackBuild
new file mode 100644
index 0000000..13b9cc3
--- /dev/null
+++ b/highlight/highlight.SlackBuild
@@ -0,0 +1,204 @@
+#!/bin/sh
+#
+# Copyright 2020 Sukma Wardana <hey@swardana.com>
+#
+# 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.
+#
+# Run 'sh highlight.SlackBuild' to build a Slackware package.
+# The package (.tgz) and .txt file as well as build logs are created in /tmp.
+# Install it using 'installpkg'.
+#
+
+# Set initial variables:
+
+PRGNAM=highlight
+VERSION=${VERSION:-3.57}
+BUILD=${BUILD:-1}
+# 'make' can run jobs in parallel for added speed. The number should be higher
+# than the number of cores/virtual CPU's in your system:
+NUMJOBS=${NUMJOBS:" -j4 "}
+# The TAG is a unique identifier for all your Slackware packages.
+# Use your initials as the value for TAG for instance.
+TAG=${TAG:-_sw}
+
+# Where do we look for sources?
+SRCDIR=$(cd $(dirname $0); pwd)
+
+# This covers most filenames you'd want as documentation. Change if needed.
+DOCS="COPYING AUTHORS INSTALL ChangeLog* README*"
+
+# Place to build (TMP) package (PKG) and output (OUTPUT) the program:
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+SOURCE="$SRCDIR/highlight-$VERSION.tar.bz2"
+SRCURL="http://www.andre-simon.de/zip/highlight-$VERSION.tar.bz2"
+
+##
+## --- with a little luck, you won't have to edit below this point --- ##
+##
+
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i486 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
+
+case "$ARCH" in
+ i486) SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+ SLKLDFLAGS=""; LIBDIRSUFFIX=""
+ ;;
+ x86_64) SLKCFLAGS="-O2 -fPIC"
+ SLKLDFLAGS="-L/usr/lib64"; LIBDIRSUFFIX="64"
+ ;;
+ *) SLKCFLAGS="-O2"
+ SLKLDFLAGS=""; LIBDIRSUFFIX=""
+ ;;
+esac
+
+# Exit the script on errors:
+set -e
+trap 'echo "$0 FAILED at line ${LINENO}" | tee $OUTPUT/error-${PRGNAM}.log' ERR
+# Catch unitialized variables:
+set -u
+P1=${1:-1}
+
+# Save old umask and set to 0022:
+_UMASK_=$(umask)
+umask 0022
+
+# Create working directories:
+mkdir -p $OUTPUT # place for the package to be saved
+mkdir -p $TMP/tmp-$PRGNAM # location to build the source
+mkdir -p $PKG # place for the package to be built
+rm -rf $PKG/* # always erase old package's contents
+rm -rf $TMP/tmp-$PRGNAM/* # remove the remnants of previous build
+rm -rf $OUTPUT/{configure,make,install,error,makepkg}-$PRGNAM.log
+ # remove old log files
+
+# Source file availability:
+if ! [ -f ${SOURCE} ]; then
+ echo "Source '$(basename ${SOURCE})' not available yet..."
+ # Check if the $SRCDIR is writable at all - if not, download to $OUTPUT
+ [ -w "$SRCDIR" ] || SOURCE="$OUTPUT/$(basename $SOURCE)"
+ if [ -f ${SOURCE} ]; then echo "Ah, found it!"; continue; fi
+ if ! [ "x${SRCURL}" == "x" ]; then
+ echo "Will download file to $(dirname $SOURCE)"
+ wget -nv -T 20 -O "${SOURCE}" "${SRCURL}" || true
+ if [ $? -ne 0 -o ! -s "${SOURCE}" ]; then
+ echo "Downloading '$(basename ${SOURCE})' failed... aborting the build."
+ mv -f "${SOURCE}" "${SOURCE}".FAIL
+ exit 1
+ fi
+ else
+ echo "File '$(basename ${SOURCE})' not available... aborting the build."
+ exit 1
+ fi
+fi
+
+if [ "$P1" == "--download" ]; then
+ echo "Download complete."
+ exit 0
+fi
+
+# --- PACKAGE BUILDING ---
+echo "++"
+echo "|| $PRGNAM-$VERSION"
+echo "++"
+
+cd $TMP/tmp-$PRGNAM
+
+echo "Extracting the source archive(s) for $PRGNAM..."
+if $(file ${SOURCE} | grep -qi ": 7-zip"); then
+ 7za x ${SOURCE}
+elif $(file ${SOURCE} | grep -qi ": zip"); then
+ unzip ${SOURCE}
+else
+ tar -xvf ${SOURCE}
+fi
+
+cd ${PRGNAM}-${VERSION}
+
+chown -R root:root .
+chmod -R u+w,go+r-w,a+X-s .
+
+echo "Building ..."
+
+# Prepare the sources
+sed -i "s|/usr|/usr/local|" makefile
+
+make cli
+make $NUMJOBS DESTDIR=$PKG install 2>&1 | tee $OUTPUT/install-${PRGNAM}.log
+
+mv $PKG/etc/$PRGNAM/filetypes.conf{,.new}
+
+# Add documentation:
+mkdir -p $PKG/usr/local/doc/$PRGNAM-$VERSION
+cp -a $DOCS $PKG/usr/local/doc/$PRGNAM-$VERSION || true
+cat $SRCDIR/$(basename $0) > $PKG/usr/local/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+chown -R root:root $PKG/usr/local/doc/$PRGNAM-$VERSION
+find $PKG/usr/local/doc -type f -exec chmod 644 {} \;
+
+# Compress the man page(s):
+if [ -d $PKG/usr/local/man ]; then
+ find $PKG/usr/local/man -type f -name "*.?" -exec gzip -9f {} \;
+ for i in $(find $PKG/usr/local/man -type l -name "*.?") ; do
+ ln -s $( readlink $i ).gz $i.gz ; rm $i ;
+ done
+fi
+
+# Compress info pages and remove the package's dir file:
+if [ -d $PKG/usr/local/info ]; then
+ rm -f $PKG/usr/local/info/dir
+ gzip -9f $PKG/usr/local/info/*.info*
+ # If any info files are present, consider adding this to a doinst.sh:
+ # chroot . install-info /usr/local/info/XXXXX.info.gz /usr/local/info/dir 2> /dev/null
+fi
+
+# Strip binaries (if any):
+find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
+ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
+
+# Add a package description:
+mkdir -p $PKG/install
+cat $SRCDIR/slack-desc > $PKG/install/slack-desc
+if [ -f $SRCDIR/doinst.sh ]; then
+ cat $SRCDIR/doinst.sh >> $PKG/install/doinst.sh
+fi
+if [ -f $SRCDIR/slack-required ]; then
+ cat $SRCDIR/slack-required > $PKG/install/slack-required
+fi
+
+# Build the package:
+cd $PKG
+makepkg --linkadd y --chown n $OUTPUT/${PRGNAM}-${VERSION}-${ARCH}-${BUILD}${TAG}.${PKGTYPE:-tgz} 2>&1 | tee $OUTPUT/makepkg-${PRGNAM}.log
+cd $OUTPUT
+md5sum ${PRGNAM}-${VERSION}-${ARCH}-${BUILD}${TAG}.${PKGTYPE:-tgz} > ${PRGNAM}-${VERSION}-${ARCH}-${BUILD}${TAG}.${PKGTYPE:-tgz}.md5
+cd -
+cat $PKG/install/slack-desc | grep "^${PRGNAM}" > $OUTPUT/${PRGNAM}-${VERSION}-${ARCH}-${BUILD}${TAG}.txt
+if [ -f $PKG/install/slack-required ]; then
+ cat $PKG/install/slack-required > $OUTPUT/${PRGNAM}-${VERSION}-${ARCH}-${BUILD}${TAG}.dep
+fi
+
+# Restore the original umask:
+umask ${_UMASK_} \ No newline at end of file
diff --git a/highlight/highlight.info b/highlight/highlight.info
new file mode 100644
index 0000000..1c688e9
--- /dev/null
+++ b/highlight/highlight.info
@@ -0,0 +1,10 @@
+PRGNAM="highlight"
+VERSION="3.57"
+HOMEPAGE="http://www.andre-simon.de/"
+DOWNLOAD="http://www.andre-simon.de/zip/highlight-3.57.tar.bz2"
+MD5SUM="cc41b4ff98577e25a0d6a0025d4b1ead"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES="lua"
+MAINTAINER="Sukma Wardana"
+EMAIL="hey@swardana.com" \ No newline at end of file
diff --git a/highlight/slack-desc b/highlight/slack-desc
new file mode 100644
index 0000000..4b977d4
--- /dev/null
+++ b/highlight/slack-desc
@@ -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 ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+highlight: highlight (a universal syntax highlighter)
+highlight:
+highlight: Highlight converts sourcecode to HTML, XHTML, RTF, LaTeX, TeX, SVG,
+highlight: BBCode and terminal escape sequences with coloured
+highlight: syntax highlighting. Language definitions and colour themes
+highlight: are customizable.
+highlight:
+highlight: Highlight was designed to offer a flexible but easy to use
+highlight: syntax highlighter for several output formats.
+highlight:
+highlight: http://www.andre-simon.de/doku/highlight/en/highlight.php \ No newline at end of file
diff --git a/highlight/slack-required b/highlight/slack-required
new file mode 100644
index 0000000..9ad5171
--- /dev/null
+++ b/highlight/slack-required
@@ -0,0 +1 @@
+lua \ No newline at end of file