# $Id: /trunk/debian/packages 117 2005-09-06T14:22:11.901397Z dexter  $

# If the debian/rules or debian/control file is missing, rebuild the file:
#
#   $ yada rebuild control
#   $ yada rebuild rules


# Other macros:

%define libfakechroot_version %`grep '^AC_INIT' configure.ac | sed 's/.*\[\([0-9][0-9.]*\)\].*/\1/'`

#   libfakechroot_version=%{libfakechroot_version}


Source: fakechroot
Section: utils
Priority: optional
Maintainer: Piotr Roszatycki <dexter@debian.org>
Standards-Version: 3.6.2
Home-Page: <URL:http://fakechroot.alioth.debian.org/>
Description: gives a fake chroot environment
Copyright: GPL
 (c) 2003-2005 Piotr Roszatycki <dexter@debian.org>, GPL
Build-Depends: libc6-dev-s390x [s390]
Build-Depends: libc6-dev-sparc64 [sparc]
Build-Depends: ia32-libs-dev [amd64]
Build: bash
 CC=${CC:-gcc}
 CFLAGS=${CFLAGS:--Wall -pedantic -g}
 if [ "${DEB_BUILD_OPTIONS#*noopt}" != "$DEB_BUILD_OPTIONS" ]; then
     CFLAGS="$CFLAGS -O0"
 else
     CFLAGS="$CFLAGS -O2 -fno-strict-aliasing"
 fi
 .
 COMMON_CONFIG="\
 	--prefix=/usr \
 	--mandir=/usr/share/man \
 	--disable-static \
 	--with-libpath=/usr/lib/fakechroot:/usr/lib64/fakechroot:/usr/lib32/fakechroot"
 .
 if ! [ -f configure-stamp ]; then
     mkdir -p build-tree-lib build-tree-fake build-tree-lib-biarch build-tree-fake-biarch
     pushd build-tree-lib
         CC="$CC" CFLAGS="$CFLAGS" \
             ../configure \
 	         --cache-file=../config.cache \
 	         --libdir=/usr/lib/fakechroot \
                 $COMMON_CONFIG
     popd
     pushd build-tree-fake
         CC="$CC" CFLAGS="$CFLAGS" \
             ../fake/configure \
 	         --cache-file=../config.cache \
                 $COMMON_CONFIG
     popd
     if [ "$DEB_BUILD_ARCH" = "s390" ]; then
         pushd build-tree-lib-biarch
             CC="gcc -m64" CFLAGS="$CFLAGS" \
                 ../configure \
 	             --cache-file=../config.biarch.cache \
 		     --build=s390-linux \
 		     --host=s390x-linux \
   	             --libdir=/usr/lib64/fakechroot \
                     $COMMON_CONFIG
         popd
         pushd build-tree-fake-biarch
             CC="gcc -m64" CFLAGS="$CFLAGS" \
                 ../fake/configure \
 	             --cache-file=../config.biarch.cache \
 		     --build=s390-linux \
 		     --host=s390x-linux \
   	             --libdir=/usr/lib64 \
                     $COMMON_CONFIG
         popd
     fi
     if [ "$DEB_BUILD_ARCH" = "sparc" ]; then
         pushd build-tree-lib-biarch
             CC="gcc -m64" CFLAGS="$CFLAGS" \
                 ../configure \
 	             --cache-file=../config.biarch.cache \
 		     --build=sparc-linux \
 		     --host=sparc64-linux \
   	             --libdir=/usr/lib64/fakechroot \
                     $COMMON_CONFIG
         popd
         pushd build-tree-fake-biarch
             CC="gcc -m64" CFLAGS="$CFLAGS" \
                 ../fake/configure \
 	             --cache-file=../config.biarch.cache \
 		     --build=sparc-linux \
 		     --host=sparc64-linux \
   	             --libdir=/usr/lib64 \
                     $COMMON_CONFIG
         popd
     fi
     if [ "$DEB_BUILD_ARCH" = "amd64" ]; then
         pushd build-tree-lib-biarch
             CC="gcc -m32" CFLAGS="$CFLAGS" \
                 ../configure \
 	             --cache-file=../config.biarch.cache \
 		     --build=x86_64-linux \
 		     --host=i386-linux \
   	             --libdir=/emul/ia32-linux/usr/lib/fakechroot \
                     $COMMON_CONFIG
         popd
         pushd build-tree-fake-biarch
             CC="gcc -m32" CFLAGS="$CFLAGS" \
                 ../fake/configure \
 	             --cache-file=../config.biarch.cache \
 		     --build=x86_64-linux \
 		     --host=i386-linux \
   	             --libdir=/emul/ia32-linux/usr/lib \
                     $COMMON_CONFIG
         popd
     fi
     sleep 1 && touch configure-stamp
 fi
 .
 if ! [ build-stamp -nt configure-stamp ]; then
     pushd build-tree-lib
         make
     popd
     pushd build-tree-fake
         make
     popd
     if [ "$DEB_BUILD_ARCH" = "s390" ] || \
        [ "$DEB_BUILD_ARCH" = "sparc" ] || \
        [ "$DEB_BUILD_ARCH" = "amd64" ]; then
         pushd build-tree-lib-biarch
             make
         popd
         pushd build-tree-fake-biarch
             make
         popd
     fi
     touch build-stamp
 fi
Clean: sh
 make distclean || make clean || true
 rm -f config.*cache || true
 rm -rf build-tree-* || true
 rm -f *-stamp || true

Package: fakechroot
Architecture: any
Description: gives a fake chroot environment
 This package provides a library which overrides libc functions, so
 it is possible to use root-specific tools without root priviliges.
 .
 In fake chroot you can install i.e. Debian bootstrap, create developer's
 environment and build packages inside chroot'ed system using standard
 non-root user account.
Install: bash
 for i in build-tree-*; do
     pushd $i
         if [ -f Makefile ]; then
             rm -rf tmp || true
             make install DESTDIR=$ROOT
         fi
     popd
 done
 find $ROOT -name *.so -print0 | xargs -0r chmod -v -x
 find $ROOT -name *.la -print0 | xargs -0r rm -v -f
 yada install -doc -subdir examples scripts/restoremode.sh scripts/savemode.sh scripts/ldd.fake
Finalize: sh
 chmod -v u+s $ROOT/usr/lib/*.so
 .
 case "$DEB_BUILD_ARCH" in
     amd64)
         chmod -v u+s $ROOT/emul/ia32-linux/usr/lib/*.so;;
     s390|sparc)
         chmod -v u+s $ROOT/usr/lib64/*.so;;
 esac
Overrides:
 non-standard-file-perm usr/lib/libfakechroot.so 0744 != 0644
 no-shlibs-control-file usr/lib/libfakechroot.so
 package-name-doesnt-match-sonames libfakechroot
 shlib-with-bad-permissions usr/lib/libfakechroot.so 0744
Contains: libs
