# Tanım: O'Caml kütüphane yöneticisi
# URL: http://projects.camlcity.org/projects/findlib.html
# Paketçi: milisarge
# Gerekler: ocaml ocaml-findlib ocaml-lablgl gtk2 librsvg libglade gtksourceview2 xorg-mesa

isim=ocaml-lablgtk
_isim=lablgtk
surum=2.18.5
devir=1
kaynak=(https://forge.ocamlcore.org/frs/download.php/1627/$isim-$surum.tar.gz)

derle() {
	cd ${_name}-$surum
	export LD_LIBRARY_PATH=/usr/lib/ocaml/stublibs/:/usr/lib/ocaml/:${LD_LIBRARY_PATH}
	
	./configure \
	--prefix=/usr \
	--libdir=/usr/lib \
	--build=$ARCH-milis-linux \
	--with-glade \
	--with-rsvg \
	--with-gtksourceview2 
	
	sed -i -e "s/\\(CFLAGS = .*\\)/\\1 ${SLKCFLAGS}/" src/Makefile
	sed -i -e "s/\\(CFLAGS += -O\\)/CFLAGS +=/" src/Makefile

	make -j1 world
	#make DESTDIR=$PKG install	
	make install BINDIR="$PKG/usr/bin/"
	mkdir -p "$PKG/usr/lib/ocaml/stublibs"
	mv /usr/lib/ocaml/site-lib/lablgtk2 "$PKG/usr/lib/ocaml/"
	cp src/dlllablglade2.so  "$PKG/usr/lib/ocaml/stublibs/"
	cp src/dlllablgtk2.so  "$PKG/usr/lib/ocaml/stublibs/"
	cp src/dlllablgtksourceview2.so  "$PKG/usr/lib/ocaml/stublibs/"
	cp src/dlllablrsvg.so "$PKG/usr/lib/ocaml/stublibs/"
	# remove file conflicting with ocaml's ones
	rm -f $PKG/usr/lib/ocaml/ld.conf
	
    
}