# Description: The Xorg applications provide the applications available in X Window implementations.
# URL: http://xorg.freedesktop.org
# Packager: pierre at nutyx dot org, tnut at nutyx dot org
# Depends on: harfbuzz libpng xorg-mesa xorg-glu xcb-util xorg-libx11 xorg-libxinerama xorg-libxt xorg-libxfont xorg-libxkbfile xorg-libxmu xorg-libxrender xorg-libxrandr xorg-libxcursor xorg-libxtst xorg-libxxf86vm xorg-libxaw xorg-xbitmaps xorg-libxv xorg-libdmx xorg-libxt 

section="app"
name=xorg-app
version=7.7
release=4

source=()

build() {
unset MAKEFLAGS
cat > list.md5 << "EOF"
53a48e1fdfec29ab2e89f86d4b7ca902  bdftopcf-1.0.5.tar.bz2
25dab02f8e40d5b71ce29a07dc901b8c  iceauth-1.0.7.tar.bz2
c4a3664e08e5a47c120ff9263ee2f20c  luit-1.1.1.tar.bz2
18c429148c96c2079edda922a2b67632  mkfontdir-1.0.7.tar.bz2
9bdd6ebfa62b1bbd474906ac86a40fd8  mkfontscale-1.1.2.tar.bz2
e238c89dabc566e1835e1ecb61b605b9  sessreg-1.1.0.tar.bz2
2c47a1b8e268df73963c4eb2316b1a89  setxkbmap-1.3.1.tar.bz2
3a93d9f0859de5d8b65a68a125d48f6a  smproxy-1.0.6.tar.bz2
f0b24e4d8beb622a419e8431e1c03cd7  x11perf-1.6.0.tar.bz2
7d6003f32838d5b688e2c8a131083271  xauth-1.0.9.tar.bz2
0066f23f69ca3ef62dcaeb74a87fdc48  xbacklight-1.2.1.tar.bz2
9956d751ea3ae4538c3ebd07f70736a0  xcmsdb-1.0.5.tar.bz2
b58a87e6cd7145c70346adad551dba48  xcursorgen-1.0.6.tar.bz2
8809037bd48599af55dad81c508b6b39  xdpyinfo-1.3.2.tar.bz2
fceddaeb08e32e027d12a71490665866  xdriinfo-1.0.5.tar.bz2
249bdde90f01c0d861af52dc8fec379e  xev-1.2.2.tar.bz2
90b4305157c2b966d5180e2ee61262be  xgamma-1.0.6.tar.bz2
f5d490738b148cb7f2fe760f40f92516  xhost-1.0.7.tar.bz2
6a889412eff2e3c1c6bb19146f6fe84c  xinput-1.6.2.tar.bz2
a4d8353daf6cb0a9c47379b7413c42c6  xkbcomp-1.3.1.tar.bz2
c747faf1f78f5a5962419f8bdd066501  xkbevd-1.1.4.tar.bz2
502b14843f610af977dffc6cbf2102d5  xkbutils-1.0.4.tar.bz2
0ae6bc2a8d3af68e9c76b1a6ca5f7a78  xkill-1.0.4.tar.bz2
5dcb6e6c4b28c8d7aeb45257f5a72a7d  xlsatoms-1.1.2.tar.bz2
9fbf6b174a5138a61738a42e707ad8f5  xlsclients-1.1.3.tar.bz2
2dd5ae46fa18abc9331bc26250a25005  xmessage-1.0.4.tar.bz2
723f02d3a5f98450554556205f0a9497  xmodmap-1.0.9.tar.bz2
6101f04731ffd40803df80eca274ec4b  xpr-1.0.4.tar.bz2
fae3d2fda07684027a643ca783d595cc  xprop-1.2.2.tar.bz2
441fdb98d2abc6051108b7075d948fc7  xrandr-1.4.3.tar.bz2
b54c7e3e53b4f332d41ed435433fbda0  xrdb-1.1.0.tar.bz2
a896382bc53ef3e149eaf9b13bc81d42  xrefresh-1.0.5.tar.bz2
dcd227388b57487d543cab2fd7a602d7  xset-1.2.3.tar.bz2
7211b31ec70631829ebae9460999aa0b  xsetroot-1.1.1.tar.bz2
558360176b718dee3c39bc0648c0d10c  xvinfo-1.1.3.tar.bz2
6b5d48464c5f366e91efd08b62b12d94  xwd-1.0.6.tar.bz2
b777bafb674555e48fd8437618270931  xwininfo-1.1.3.tar.bz2
3025b152b4f13fdffd0c46d0be587be6  xwud-1.0.4.tar.bz2
EOF
for package in $(grep -v '^#' list.md5 |cut -d " " -f 3)
	do
		#agdan ceker
		wget http://mirror.switch.ch/ftp/mirror/X11/pub/individual/${section}/$package
		#yerelden
		#cp /sources/$package .
		grep $package list.md5 |md5sum -c -
		packagedir=$(echo $package | sed 's/.tar.bz2//')
		tar -xf $package

		pushd $packagedir
		case $packagedir in
			luit-[0-9]* )
				line1="#ifdef _XOPEN_SOURCE"
				line2="#  undef _XOPEN_SOURCE"
				line3="#  define _XOPEN_SOURCE 600"
				line4="#endif"
				sed -i -e "s@#ifdef HAVE_CONFIG_H@$line1\n$line2\n$line3\n$line4\n\n&@" sys.c
				unset line1 line2 line3 line4
			;;
			sessreg-* )
				sed -e 's/\$(CPP) \$(DEFS)/$(CPP) -P $(DEFS)/' -i man/Makefile.in
			;;
		esac
		./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
		make
		make DESTDIR=$PKG install
		popd
	done
}
