From 6375d5b12e194283a398ccf27d8bde9eb10ba792 Mon Sep 17 00:00:00 2001 From: Larry Hajali Date: Tue, 8 Jan 2013 17:20:32 +0100 Subject: [PATCH] libraries/soil: Added (C OpenGL texture library). Signed-off-by: Matteo Bernardini --- libraries/soil/README | 7 ++ libraries/soil/linking_correctly.patch | 25 ++++++ libraries/soil/slack-desc | 19 +++++ libraries/soil/soil.SlackBuild | 102 +++++++++++++++++++++++++ libraries/soil/soil.info | 10 +++ 5 files changed, 163 insertions(+) create mode 100644 libraries/soil/README create mode 100644 libraries/soil/linking_correctly.patch create mode 100644 libraries/soil/slack-desc create mode 100644 libraries/soil/soil.SlackBuild create mode 100644 libraries/soil/soil.info diff --git a/libraries/soil/README b/libraries/soil/README new file mode 100644 index 0000000000..26ef92ecce --- /dev/null +++ b/libraries/soil/README @@ -0,0 +1,7 @@ +SOIL is a tiny C library used primarily for uploading textures into +OpenGL. It is based on stb_image version 1.16, the public domain code +from Sean Barrett. The author has extended it to load TGA and DDS +files, and to perform common functions needed in loading OpenGL +textures. SOIL can also be used to save and load images in a variety +of formats (useful for loading height maps, non-OpenGL applications, +etc.) diff --git a/libraries/soil/linking_correctly.patch b/libraries/soil/linking_correctly.patch new file mode 100644 index 0000000000..edae0d9569 --- /dev/null +++ b/libraries/soil/linking_correctly.patch @@ -0,0 +1,25 @@ +We need to add -fPIC for the dynamic lib. Additionally this links +libsoil against libm and libGL as it uses symbols from them. + +diff --git a/projects/makefile/alternate Makefile.txt b/projects/makefile/alternate Makefile.txt +index b2ff3a4..649526b 100644 +--- a/projects/makefile/alternate Makefile.txt ++++ b/projects/makefile/alternate Makefile.txt +@@ -4,7 +4,7 @@ INSTALL_FILE = install -p -o root -g root -m 644 + INSTALL_DIR = install -p -o root -g root -d + LN = ln -s + RM = rm -fv +-CFLAGS += -c -O2 -Wall ++CFLAGS += -c -Wall -fPIC + LDFLAGS += + + CFILES = image_DXT.c image_helper.c SOIL.c stb_image_aug.c +@@ -29,7 +29,7 @@ lib: $(OFILES) + # create static library + ar -cvq $(LIBNAME).a $(OFILES) + # create shared library +- gcc -shared -Wl,-soname,$(LIBNAME).so.$(MAJOR) -o $(LIBNAME).so.$(VERSION) $(OFILES) ++ gcc -shared -Wl,-soname,$(LIBNAME).so.$(MAJOR) -o $(LIBNAME).so.$(VERSION) $(OFILES) -lGL -lm + + install: + $(INSTALL_DIR) $(DESTDIR)/$(INCLUDEDIR) diff --git a/libraries/soil/slack-desc b/libraries/soil/slack-desc new file mode 100644 index 0000000000..2576f425e5 --- /dev/null +++ b/libraries/soil/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------------------------------------------------------| +soil: soil (C OpenGL texture library) +soil: +soil: SOIL is a tiny C library used primarily for uploading textures into +soil: OpenGL. It is based on stb_image version 1.16, the public domain code +soil: from Sean Barrett. The author has extended it to load TGA and DDS +soil: files, and to perform common functions needed in loading OpenGL +soil: textures. SOIL can also be used to save and load images in a variety +soil: of formats (useful for loading height maps, non-OpenGL applications, +soil: etc.) +soil: +soil: Homepage: http://www.lonesock.net/soil.html diff --git a/libraries/soil/soil.SlackBuild b/libraries/soil/soil.SlackBuild new file mode 100644 index 0000000000..941a833ebf --- /dev/null +++ b/libraries/soil/soil.SlackBuild @@ -0,0 +1,102 @@ +#!/bin/sh + +# Slackware build script for soil + +# Copyright 2013 Larry Hajali +# 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=soil +VERSION=${VERSION:-1.07} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} +DIRNAM="Simple OpenGL Image Library" + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i486 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf "$DIRNAM" +unzip $CWD/$PRGNAM.zip +cd "$DIRNAM" +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 {} \; + +patch -p1 < $CWD/linking_correctly.patch + +cd src + make \ + CFLAGS="$SLKCFLAGS -c -fPIC -Wall" \ + LIBDIR="/usr/lib${LIBDIRSUFFIX}" \ + -f "../projects/makefile/alternate Makefile.txt" + make install DESTDIR=$PKG \ + LIBDIR="/usr/lib${LIBDIRSUFFIX}" \ + INSTALL_FILE="install -pm 644" \ + INSTALL_DIR="install -dp" \ + -f "../projects/makefile/alternate Makefile.txt" +cd .. + +# Fix permissions on shared library and remove static library. +chmod 755 $PKG/usr/lib${LIBDIRSUFFIX}/libSOIL.so.${VERSION}-20071110 +rm -f $PKG/usr/lib${LIBDIRSUFFIX}/libSOIL.a + +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 + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a soil.html $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/libraries/soil/soil.info b/libraries/soil/soil.info new file mode 100644 index 0000000000..19109bb895 --- /dev/null +++ b/libraries/soil/soil.info @@ -0,0 +1,10 @@ +PRGNAM="soil" +VERSION="1.07" +HOMEPAGE="http://www.lonesock.net/soil.html" +DOWNLOAD="http://www.lonesock.net/files/soil.zip" +MD5SUM="4736ac4f34fd9a41fa0197eac23bbc24" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="Larry Hajali" +EMAIL="larryhaja[at]gmail[dot]com"