# Contributor: Johannes Matheis <jomat+alpinebuild@jmt.gr>
# Maintainer: Johannes Matheis <jomat+alpinebuild@jmt.gr>
pkgname=xdm
pkgver=1.1.11
pkgrel=5
pkgdesc="X Display Manager"
url="http://xorg.freedesktop.org/"
arch="all"
license="MIT"
depends="sessreg"
depends_dev="linux-pam-dev libxmu-dev libxaw-dev"
makedepends="$depends_dev"
install=""
subpackages="$pkgname-doc"
source="
	$url/releases/individual/app/$pkgname-$pkgver.tar.bz2
	$pkgname.initd
	$pkgname.confd
	Xresources.alpinelinux
	Xresources.alpinelinux_old
	alpinelinux_old_blue_black.xpm
	alpinelinux_white_blue.xpm
"
builddir="$srcdir"/$pkgname-$pkgver

prepare() {
	default_prepare
	update_config_guess
}

build() {
	cd "$builddir"
	./configure \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		--enable-ipv6 \
		--with-xdmconfigdir=/etc/X11/$pkgname \
		--with-pam
	make
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install

	install -Dm755 "$srcdir"/$pkgname.initd \
		"$pkgdir"/etc/init.d/$pkgname
	install -Dm644 "$srcdir"/$pkgname.confd \
		"$pkgdir"/etc/conf.d/$pkgname

	install -D -m644 "$srcdir"/Xresources.alpinelinux \
		"$pkgdir"/etc/X11/$pkgname/Xresources.alpinelinux
	install -D -m644 "$srcdir"/Xresources.alpinelinux_old \
		"$pkgdir"/etc/X11/$pkgname/Xresources.alpinelinux_old
	install -D -m644 "$srcdir"/alpinelinux_old_blue_black.xpm \
		"$pkgdir"/etc/X11/$pkgname/pixmaps/alpinelinux_old_blue_black.xpm
	install -D -m644 "$srcdir"/alpinelinux_white_blue.xpm \
		"$pkgdir"/etc/X11/$pkgname/pixmaps/alpinelinux_white_blue.xpm
}

sha512sums="fe6f2b7817c0f7f07a1f5f497edcdfa15b93986fd87f314daa472dac8625327ef46ebbf40d27fe8d4a8a2f8d5af8a01c4438a29356740e0eb350f2bd0c7ec0d5  xdm-1.1.11.tar.bz2
20c1ada62d139fe8c8f8f7d6479ff45f6c009dbf5af454939bd11433700d8c5ef56a2068645ee0ab31e16cea29e708836f80a598ae708179844d56e31b90cfaa  xdm.initd
9d08ee82afeb85e7d9e0a1013226a44bdbef8d6da227f5fef7734524861c41f0cdc9ba4616b2faaf3a8d4b16134115ed004bf0a5fcf71be7c6e13506fbcda95b  xdm.confd
2a9db579323d680b6b3d7a0377ea1140c8570870c4f06f2ecc5e0ec73233b3621e46823ff3f694d8fa296a4de83b4fd62c2635c3c6b413b613ebe83cba4cf033  Xresources.alpinelinux
5d667541fdb39bdbd637da45e05a243736af32b7aa75ce27f2bbf097bce2fad87932619b372ab03add29b0bef7dd8816eb89875fbf2426eba83978d720687d90  Xresources.alpinelinux_old
b55424fd9ea0970fdbecd11c1abecf41cad1a7ede03f38011f666ae4eed2a88def5ac364bdf4ebcac09fa66963ed534e85faff74fcd01e9f040229d999382472  alpinelinux_old_blue_black.xpm
3872c54ad6fd6aa6c893f5f950801ae079bb7b6d375a05ef2262eb244a96ea3e949ab3cd962e005acf957c9ad4d30caee4c3935d7864a196625e8bfed9bc5adf  alpinelinux_white_blue.xpm"
