rendered paste body#!/bin/sh
# Script by Zeqadious
#Modified by Uelsk8s
# PACKAGE: fontconfig
# DEPENDENCIES: freetype
# HOMEPAGE: fontconfig.org
# Verify script is being run by root
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root!"
exit
fi
# Echo the instructions on how to use...
if [ "${1}" = "--help" ]; then
echo \
"${0} script:
--nocleanup Do NOT Cleanup of Post build and Temporary Repo
--help Displays this help"
exit
fi
# ------ Setup
CWD=$(pwd)
TMP=${CWD}/build
PKG=${TMP}/package
if [ "${1}" = "--nocleanup" ]; then
CLEANUP="0"
else
CLEANUP="1"
fi
# Package Credentials
NAME=fontconfig
VERSION=2.4.2
ARCH=${ARCH:-"i586"}
BUILD=${BUILD:-2vl58}
REPO=${REPO:-"${HOME}/packages"}
SOURCE=( http://fontconfig.org/release/${NAME}-${VERSION}.tar.gz fonts.conf )
#CFLAGS=${CFLAGS:-"-O2 -pipe -march=i586 -mtune=i686"}
# Setup Build Location
if [ ! -d ${TMP} ]; then
install -d -m700 ${TMP}
fi
# Use this section if a slack-desc is not already provided in the Working Directory
install -d -m755 ${PKG}/install
cat > ${PKG}/install/slack-desc << EoF
# |-----handy-ruler------------------------------------------------------|
${NAME}: ${NAME} (${VERSION})
${NAME}:
${NAME}: The Fontconfig package is a library for configuring and customizing
${NAME}: font access.
${NAME}:
${NAME}:
${NAME}:
${NAME}:
${NAME}:
${NAME}:
${NAME}:
${NAME}:
${NAME}: Created for: Vectorlinux | Packaged by: Uelsk8s
EoF
# ------ Retrieve & Decompress
cd ${TMP}
if [ ! -f $SOURCE ];then
$(which wget) -c ${SOURCE}
fi
tar zxvf ${NAME}-${VERSION}.tar.gz
# ------ Build
cd ${NAME}-${VERSION}
CFLAGS="${CFLAGS}" \
CXXFLAGS="${CFLAGS}" \
./configure \
--prefix=/usr \
--program-prefix="" \
--program-suffix="" \
--sysconfdir=/etc \
--localstatedir=/var \
--mandir=/usr/man \
--infodir=/usr/info \
--enable-static="no" \
--enable-shared="yes" \
--without-add-fonts \
--with-docdir=/usr/doc/${NAME}-${VERSION} \
${ARCH}-slackware-linux
# Build
make || exit
# Install to Package
make install DESTDIR=${PKG}
# ------ Zenify
# Install Zenwalk fonts.conf
#install -m644 ${CWD}/${SOURCE[1]} ${PKG}/etc/fonts/fonts.conf
# Strip Libraries and Binaries
find ${PKG} | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
find ${PKG} | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
# Gzip Man Pages
find $PKG/usr/man -type f -exec gzip -9f {} \;
# Copy Documentation
install -d -m755 ${PKG}/usr/doc/${NAME}-${VERSION}
cp -a \
AUTHORS* COPYING* INSTALL* NEWS* README* ChangeLog* \
${PKG}/usr/doc/${NAME}-${VERSION}
# Move Documentation Incorrectly Installed to Correct Loc.
if [ -d ${PKG}/usr/share/doc ]; then
( cd ${PKG}/usr/share/doc ; mv -v * ${PKG}/usr/doc/${NAME}-${VERSION} )
rm -rf ${PKG}/usr/share/doc
fi
# Copy Buildscript
install -d -m755 ${PKG}/usr/src/${NAME}-${VERSION}
install -m755 ${CWD}/${0} ${PKG}/usr/src/${NAME}-${VERSION}/build-${NAME}.sh
# Fix Permissions
find ${PKG} -exec chown -R root:root # <= This is fscking stupid...
find ${PKG} -perm 664 -exec chmod 644 {} \;
find ${PKG} -perm 600 -exec chmod 644 {} \;
find ${PKG} -perm 444 -exec chmod 644 {} \;
find ${PKG} -perm 400 -exec chmod 644 {} \;
find ${PKG} -perm 440 -exec chmod 644 {} \;
find ${PKG} -perm 777 -exec chmod 755 {} \;
find ${PKG} -perm 775 -exec chmod 755 {} \;
find ${PKG} -perm 511 -exec chmod 755 {} \;
find ${PKG} -perm 711 -exec chmod 755 {} \;
find ${PKG} -perm 555 -exec chmod 755 {} \;
find ${PKG}/usr/doc -type f -exec chmod 644 {} \;
# ------ Create
# Build the final Package in the Final Repository and provide the md5 checksum
if [ ! -d ${REPO} ]; then
install -v -d -m755 ${REPO}
fi
cd ${PKG}
# Don't put symlinks in doinst.sh (bad habit)
makepkg -l n -c n -p ${REPO}/${NAME}-${VERSION}-${ARCH}-${BUILD}.tlz
# Generate md5
( cd ${REPO} ; md5sum ${NAME}-${VERSION}-${ARCH}-${BUILD}.tlz \
> ${NAME}-${VERSION}-${ARCH}-${BUILD}.md5 )
# ------ Cleanup
if [ "${CLEANUP}" = "1" ]; then
rm -rf ${TMP}
fi