aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreschnett <eschnett@d47fded2-66c1-406f-af09-4fc0800f9c6b>2011-01-26 19:01:14 +0000
committereschnett <eschnett@d47fded2-66c1-406f-af09-4fc0800f9c6b>2011-01-26 19:01:14 +0000
commitd51c1def5a0e9154f2e3afa8df51b717a15b9f60 (patch)
treee333c51e40c102dc266abfe97e53c99ce4fde478
parentf59073bce69503a7391bebc8bbe749df8ae5127e (diff)
Initial version of zlib thorn
git-svn-id: http://svn.cactuscode.org/projects/ExternalLibraries/zlib/trunk@2 d47fded2-66c1-406f-af09-4fc0800f9c6b
-rw-r--r--README28
-rw-r--r--configuration.ccl8
-rw-r--r--dist/install.diff16
-rw-r--r--dist/zlib-1.2.5.tar.gzbin0 -> 544640 bytes
-rw-r--r--interface.ccl3
-rw-r--r--param.ccl1
-rw-r--r--schedule.ccl1
-rw-r--r--src/make.code.defn7
-rw-r--r--zlib.sh169
9 files changed, 233 insertions, 0 deletions
diff --git a/README b/README
new file mode 100644
index 0000000..99990c5
--- /dev/null
+++ b/README
@@ -0,0 +1,28 @@
+Cactus Code Thorn zlib
+Author(s) : Erik Schnetter
+Maintainer(s): Cactus team
+Licence : ?
+--------------------------------------------------------------------------
+
+1. Purpose
+
+Distribute the zlib library; see <http://www.zlib.net/>
+
+
+
+From the web site:
+
+A Massively Spiffy Yet Delicately Unobtrusive Compression Library
+(Also Free, Not to Mention Unencumbered by Patents)
+
+zlib is designed to be a free, general-purpose, legally unencumbered
+-- that is, not covered by any patents -- lossless data-compression
+library for use on virtually any computer hardware and operating
+system. The zlib data format is itself portable across platforms.
+Unlike the LZW compression method used in Unix compress(1) and in the
+GIF image format, the compression method currently used in zlib
+essentially never expands the data. (LZW can double or triple the file
+size in extreme cases.) zlib's memory footprint is also independent of
+the input data and can be reduced, if necessary, at some cost in
+compression. A more precise, technical discussion of both points is
+available on another page.
diff --git a/configuration.ccl b/configuration.ccl
new file mode 100644
index 0000000..ad6a6ed
--- /dev/null
+++ b/configuration.ccl
@@ -0,0 +1,8 @@
+# Configuration definitions for thorn zlib
+
+PROVIDES zlib
+{
+ SCRIPT zlib.sh
+ LANG bash
+ OPTIONS ZLIB_DIR
+}
diff --git a/dist/install.diff b/dist/install.diff
new file mode 100644
index 0000000..f8e4951
--- /dev/null
+++ b/dist/install.diff
@@ -0,0 +1,16 @@
+diff -ru zlib-1.2.5.orig/Makefile.in zlib-1.2.5/Makefile.in
+--- zlib-1.2.5.orig/Makefile.in 2010-04-20 00:12:21.000000000 -0400
++++ zlib-1.2.5/Makefile.in 2011-01-01 19:43:38.000000000 -0500
+@@ -167,9 +167,9 @@
+ -@if [ ! -d $(DESTDIR)$(sharedlibdir) ]; then mkdir -p $(DESTDIR)$(sharedlibdir); fi
+ -@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi
+ -@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi
+- cp $(STATICLIB) $(DESTDIR)$(libdir)
+- cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)
+- cd $(DESTDIR)$(libdir); chmod u=rw,go=r $(STATICLIB)
++ -cp $(STATICLIB) $(DESTDIR)$(libdir)
++ -cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)
++ -cd $(DESTDIR)$(libdir); chmod u=rw,go=r $(STATICLIB)
+ -@(cd $(DESTDIR)$(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
+ -@cd $(DESTDIR)$(sharedlibdir); if test "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \
+ chmod 755 $(SHAREDLIBV); \
diff --git a/dist/zlib-1.2.5.tar.gz b/dist/zlib-1.2.5.tar.gz
new file mode 100644
index 0000000..16a637b
--- /dev/null
+++ b/dist/zlib-1.2.5.tar.gz
Binary files differ
diff --git a/interface.ccl b/interface.ccl
new file mode 100644
index 0000000..72b175b
--- /dev/null
+++ b/interface.ccl
@@ -0,0 +1,3 @@
+# Interface definition for thorn zlib
+
+IMPLEMENTS: zlib
diff --git a/param.ccl b/param.ccl
new file mode 100644
index 0000000..a122437
--- /dev/null
+++ b/param.ccl
@@ -0,0 +1 @@
+# Parameter definitions for thorn zlib
diff --git a/schedule.ccl b/schedule.ccl
new file mode 100644
index 0000000..59f8c2e
--- /dev/null
+++ b/schedule.ccl
@@ -0,0 +1 @@
+# Schedule definitions for thorn zlib
diff --git a/src/make.code.defn b/src/make.code.defn
new file mode 100644
index 0000000..445638d
--- /dev/null
+++ b/src/make.code.defn
@@ -0,0 +1,7 @@
+# Main make.code.defn file for thorn zlib
+
+# Source files in this directory
+SRCS =
+
+# Subdirectories containing source files
+SUBDIRS =
diff --git a/zlib.sh b/zlib.sh
new file mode 100644
index 0000000..c10c354
--- /dev/null
+++ b/zlib.sh
@@ -0,0 +1,169 @@
+#! /bin/bash
+
+################################################################################
+# Prepare
+################################################################################
+
+# Set up shell
+set -x # Output commands
+set -e # Abort on errors
+
+
+
+################################################################################
+# Search
+################################################################################
+
+if [ -z "${ZLIB_DIR}" ]; then
+ echo "BEGIN MESSAGE"
+ echo "zlib selected, but ZLIB_DIR not set. Checking some places..."
+ echo "END MESSAGE"
+
+ FILES="include/zlib.h lib/libz.a"
+ DIRS="/usr /usr/local /usr/local/zlib /usr/local/packages/zlib /usr/local/apps/zlib /opt/local ${HOME} ${HOME}/zlib c:/packages/zlib"
+ for dir in $DIRS; do
+ ZLIB_DIR="$dir"
+ for file in $FILES; do
+ if [ ! -r "$dir/$file" ]; then
+ unset ZLIB_DIR
+ break
+ fi
+ done
+ if [ -n "$ZLIB_DIR" ]; then
+ break
+ fi
+ done
+
+ if [ -z "$ZLIB_DIR" ]; then
+ echo "BEGIN MESSAGE"
+ echo "zlib not found"
+ echo "END MESSAGE"
+ else
+ echo "BEGIN MESSAGE"
+ echo "Found zlib in ${ZLIB_DIR}"
+ echo "END MESSAGE"
+ fi
+fi
+
+
+
+################################################################################
+# Build
+################################################################################
+
+if [ -z "${ZLIB_DIR}" -o "${ZLIB_DIR}" = 'BUILD' ]; then
+ echo "BEGIN MESSAGE"
+ echo "Building zlib..."
+ echo "END MESSAGE"
+
+ # Set locations
+ THORN=zlib
+ NAME=zlib-1.2.5
+ SRCDIR=$(dirname $0)
+ BUILD_DIR=${SCRATCH_BUILD}/build/${THORN}
+ INSTALL_DIR=${SCRATCH_BUILD}/external/${THORN}
+ DONE_FILE=${SCRATCH_BUILD}/done/${THORN}
+ ZLIB_DIR=${INSTALL_DIR}
+
+(
+ exec >&2 # Redirect stdout to stderr
+ set -x # Output commands
+ set -e # Abort on errors
+ cd ${SCRATCH_BUILD}
+ if [ -e ${DONE_FILE} -a ${DONE_FILE} -nt ${SRCDIR}/dist/${NAME}.tar.gz \
+ -a ${DONE_FILE} -nt ${SRCDIR}/zlib.sh ]
+ then
+ echo "zlib: The enclosed zlib library has already been built; doing nothing"
+ else
+ echo "zlib: Building enclosed zlib library"
+
+ # Should we use gmake or make?
+ MAKE=$(gmake --help > /dev/null 2>&1 && echo gmake || echo make)
+ # Should we use gtar or tar?
+ TAR=$(gtar --help > /dev/null 2> /dev/null && echo gtar || echo tar)
+ # Should we use gpatch or patch?
+ if [ -z "$PATCH" ]; then
+ PATCH=$(gpatch -v > /dev/null 2>&1 && echo gpatch || echo patch)
+ fi
+
+ # Set up environment
+ export LDFLAGS
+ unset LIBS
+ if echo '' ${ARFLAGS} | grep 64 > /dev/null 2>&1; then
+ export OBJECT_MODE=64
+ fi
+
+ echo "zlib: Preparing directory structure..."
+ mkdir build external done 2> /dev/null || true
+ rm -rf ${BUILD_DIR} ${INSTALL_DIR}
+ mkdir ${BUILD_DIR} ${INSTALL_DIR}
+
+ echo "zlib: Unpacking archive..."
+ pushd ${BUILD_DIR}
+ ${TAR} xzf ${SRCDIR}/dist/${NAME}.tar.gz
+ ${PATCH} -p0 < ${SRCDIR}/dist/install.diff
+
+ echo "zlib: Configuring..."
+ cd ${NAME}
+ # Guess whether Cactus uses static linking, and if so, build
+ # only static libraries
+ ./configure --prefix=${ZLIB_DIR} $(if echo '' ${LDFLAGS} | grep -q static; then echo '' '--static'; fi)
+
+ echo "zlib: Building..."
+ ${MAKE}
+
+ echo "zlib: Installing..."
+ ${MAKE} install prefix=${ZLIB_DIR}
+ popd
+
+ echo "zlib: Cleaning up..."
+ rm -rf ${BUILD_DIR}
+
+ date > ${DONE_FILE}
+ echo "zlib: Done."
+ fi
+)
+
+ if (( $? )); then
+ echo 'BEGIN ERROR'
+ echo 'Error while building zlib. Aborting.'
+ echo 'END ERROR'
+ exit 1
+ fi
+
+fi
+
+
+
+################################################################################
+# Check for additional libraries
+################################################################################
+
+# Set options
+if [ "${ZLIB_DIR}" = '/usr' -o "${ZLIB_DIR}" = '/usr/local' ]; then
+ ZLIB_INC_DIRS=''
+ ZLIB_LIB_DIRS=''
+else
+ ZLIB_INC_DIRS="${ZLIB_DIR}/include"
+ ZLIB_LIB_DIRS="${ZLIB_DIR}/lib"
+fi
+ZLIB_LIBS='z'
+
+
+
+################################################################################
+# Configure Cactus
+################################################################################
+
+# Pass options to Cactus
+echo "BEGIN MAKE_DEFINITION"
+echo "HAVE_ZLIB = 1"
+echo "ZLIB_DIR = ${ZLIB_DIR}"
+echo "ZLIB_INC_DIRS = ${ZLIB_INC_DIRS}"
+echo "ZLIB_LIB_DIRS = ${ZLIB_LIB_DIRS}"
+echo "ZLIB_LIBS = ${ZLIB_LIBS}"
+echo "END MAKE_DEFINITION"
+
+echo 'INCLUDE_DIRECTORY $(ZLIB_INC_DIRS)'
+echo 'LIBRARY_DIRECTORY $(ZLIB_LIB_DIRS)'
+echo 'LIBRARY $(ZLIB_LIBS)'