# Description: X File Explorer.
# URL: http://roland65.free.fr/xfe/
# Packager: Johannes, Schick dot Johannes at gmail dot com
# Maintainer: Victor Martinez, pitillo at ono dot com
# Arch Maintainer System Team devel at crux-arm dot nu
# Depends on: fox intltool

name=xfe
version=1.32.1
release=2
source=(http://dl.sourceforge.net/sourceforge/xfe/$name-$version.tar.gz)

build() {
  cd $name-$version
  export FOX_CONFIG="1"

  sed -e 's|`$FOX_CONFIG --libs \| grep Xft`|"-L$CLFS/usr/lib -lFOX-1.6 -lXext -lX11 -lXcursor -ldl -lXft -lXrender -lfontconfig -lfreetype -lX11 -lz -lpthread -lrt -ljpeg -lpng -ltiff -lz -lbz2 -lm"|g' \
      -e 's|`$FOX_CONFIG --cflags`|"-I$CLFS/usr/include/fox-1.6"|g' \
      -e 's|`$xft_config --cflags`|-I$CLFS/usr/include|g' \
      -e 's|`$xft_config --libs`|-L$CLFS/usr/lib -lXft|g' \
      -e 's|`$freetype_config --cflags`|"-I$CLFS/usr/include -I$CLFS/usr/include/freetype2"|g' \
      -e 's|`$freetype_config --libs`|"-L$CLFS/usr/lib -lfreetype"|g' -i configure

  echo "ac_cv_func_malloc_0_nonnull=yes" > config.cache
  ./configure --build=$CHOST \
              --host=$CTARGET \
              --prefix=/usr \
              --disable-nls \
              --mandir=$PKG/usr/man \
              --enable-release \
              --cache-file=config.cache 
  
  sed -e '/#undef malloc/d' -e '/#undef realloc/d' -i config.h.in
  
  make
  make prefix=$PKG/usr install
}