#!/bin/bash # Copyright (C) 2009, 2011 Matias A. Fonzo, # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . set -e CWD=$(pwd) TMP=${TMP:-/tmp/sources} OUT=${OUT:-/tmp/packages} V=1.8.3 ARCH=${ARCH:-i486} B=2 # Flags for the compiler: DCFLAGS=${DCFLAGS:=-O2 -march=i486 -mtune=i686} PKG=${TMP}/package-gdbm rm -rf $PKG mkdir -p $PKG $OUT echo "Uncompressing the tarball..." rm -rf ${TMP}/gdbm-${V} tar xvf ${CWD}/gdbm-${V}.tar.lz -C $TMP cd ${TMP}/gdbm-${V} # Set sane ownerships and permissions: chown -R 0:0 . find . \ \( -perm 2777 -o \ -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 {} + # Apply patches. # # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=208927 zcat ${CWD}/patches/gdbm-1.8.3-zeroheaders.patch.gz | patch -p1 -b --verbose # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=274417 zcat ${CWD}/patches/gdbm-1.8.3-shortread.patch.gz | patch -p1 -b --verbose # dbm_open compatibility function will not lock the database if # NDBM_LOCK environment variable is set to false. This is useful: # * old applications handle locks themselves (POSIX man page says that # ndbm did not use to lock files, see dbm_clearerr(3p)) # * locks are degrading performance a lot on NFS shares zcat ${CWD}/patches/gdbm-1.8.3-ndbmlock.patch.gz | patch -p1 -b --verbose # Prevent compilation of c++ files that use gdbm from warnings. # g++ compilator complained about the use of anonymous class zcat ${CWD}/patches/gdbm-1.8.3-filestruct.patch.gz | patch -p1 -b --verbose CFLAGS="$DCFLAGS" \ ./configure \ --prefix=/usr \ --localstatedir=/var \ --infodir=/usr/info \ --mandir=/usr/man \ --build=${ARCH}-dragora-linux-gnu make make install INSTALL_ROOT=$PKG strip --strip-unneeded ${PKG}/usr/lib/*.so* strip --strip-debug ${PKG}/usr/lib/*.a # This breaks with the support of DBM in Python, # mod_ssl and others; don't use it: #make install-compat INSTALL_ROOT=$PKG # Fix ownerships (bin:bin): chown -R 0:0 $PKG # Compress info/man pages: gzip -9N \ ${PKG}/usr/info/gdbm.info \ ${PKG}/usr/man/man3/gdbm.3 # Add the documentation: mkdir -p ${PKG}/usr/doc/gdbm-${V} cp -a \ COPYING ChangeLog NEWS README \ ${PKG}/usr/doc/gdbm-${V} # Copy the description files: mkdir -p ${PKG}/description cp ${CWD}/description/* ${PKG}/description cd $PKG makepkg -l ${OUT}/gdbm-${V}-${ARCH}-${B}.tlz