# Tanım: Grafiksel oturum açma yardımcı programı
# URL: http://sourceforge.net/projects/slim.berlios
# Paketçi: milisarge
# Gerekler: xorg-xauth libjpeg-turbo libpng cmake xorg-libxft
# Grup: masaüstü

isim=slim
surum=2.0
devir=3
kaynak=(http://kaynaklar.milislinux.org/slim-$surum.tar.gz
        panel.png
		https://raw.githubusercontent.com/yakar/milis-linux-wallpapers/master/milis-linux-tree.png
		slim.conf
		CMakeLists.txt.patch
		slim-1.3.6_freetype-2.5.1.diff
        slim.logrotate
		slim.theme)

derle() {
cd $isim-$surum

patch -p0 < $SRC/CMakeLists.txt.patch
patch -p1 < $SRC/slim-1.3.6_freetype-2.5.1.diff

# Fix location of man-pages
sed "s/share\/man/man/" -i CMakeLists.txt
sed -i "s/DESTINATION lib/DESTINATION lib64/" CMakeLists.txt

mkdir -p build


cd build
  cmake \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DUSE_CONSOLEKIT=no \
    -DCMAKE_BUILD_TYPE=Release ..
  make
  make install DESTDIR=$PKG
cd ..

mv $SRC/slim.conf $PKG/etc/slim.conf

mkdir -p $PKG/etc/logrotate.d
cat $SRC/slim.logrotate > $PKG/etc/logrotate.d/slim

# Kill the incorrectly-placed (and useless anyway) systemd stuff
rm -rf $PKG/usr/usr
# Kill systemd stuff
rm -rf $PKG/lib

find $PKG/usr/man -type f -exec gzip -9 {} \;
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done

# Remove slimlock as we don't build it
rm $PKG/usr/man/man1/slimlock.1.gz
rm $PKG/etc/init.d/slim.init
rm -rf $PKG/usr/share/slim/themes/xamplar
rm -rf $PKG/usr/man/

install -d $PKG/usr/share/slim/themes/milis
cp $SRC/panel.png $PKG/usr/share/slim/themes/milis/
cp $SRC/milis-linux-tree.png $PKG/usr/share/slim/themes/milis/background.png
cp $SRC/slim.theme $PKG/usr/share/slim/themes/milis/
chmod 0644 $PKG/usr/share/slim/themes/milis/*

cd /sources/milis.git/ayarlar/servisler
make DESTDIR=$PKG kur-slim
}
