package util-macros {
	description = "X.Org Autotools macros";
	website = "https://xorg.freedesktop.org";
	anitya = 5252;

	version# = "1.20.2";
	source = remoteTar {
		url = "https://www.x.org/releases/individual/util/"+
			"util-macros-"+version+".tar.gz";
		checksum = "Ze8QH3Z3emC0pWFP-0nUYeMy7aBW3L_dxBBmVgcumIHNzEKc1iGTR-yUFR3JcM1G";
		compress = gzip;
	};

	exec = make {};
}

package libxtrans {
	description = "X Window System Protocols Transport layer shared code";
	website = "https://gitlab.freedesktop.org/xorg/lib/libxtrans";
	anitya = 13441;

	version# = "1.6.0";
	source = remoteGitLab {
		domain = "gitlab.freedesktop.org";
		suffix = "xorg/lib/libxtrans";
		ref = "xtrans-"+version;
		checksum = "1cxDCF59fLf1HyGDMcjR1L50ZbjD0RTTEDUpOJYcHXu6HUK_Ds0x-KREY7rLNxu9";
	};

	exec = make {
		generate = "NOCONFIGURE=1 ./autogen.sh";
	};

	inputs = [
		automake,
		libtool,
		pkgconf,

		util-macros,
	];
}

package xorgproto {
	description = "X Window System unified protocol definitions";
	website = "https://gitlab.freedesktop.org/xorg/proto/xorgproto";
	anitya = 17190;

	version# = "2025.1";
	source = remoteGitLab {
		domain = "gitlab.freedesktop.org";
		suffix = "xorg/proto/xorgproto";
		ref = "xorgproto-"+version;
		checksum = "pTwJiBJHKA6Rgm3cVDXy1lyvXNIUzTRaukvvYdk1xWoJ_1G-Dfjm9MyewuyIjoHz";
	};

	exec = make {
		generate = "NOCONFIGURE=1 ./autogen.sh";
	};

	inputs = [
		automake,
		pkgconf,

		util-macros,
	];
}

package libXau {
	description = "functions for handling Xauthority files and entries";
	website = "https://gitlab.freedesktop.org/xorg/lib/libxau";
	anitya = 1765;

	version# = "1.0.12";
	source = remoteGitLab {
		domain = "gitlab.freedesktop.org";
		suffix = "xorg/lib/libxau";
		ref = "libXau-"+version;
		checksum = "aCRhtP9ERNpqEtH7T6xSifPKguPppiPYCq7ah3M-i732nrPu_-g8tPSgMslHdB5p";
	};

	exec = meson {
		setup = {
			"default_library": "both";
		};
	};

	inputs = [ xorgproto ];
	runtime = [ xorgproto ];
}

package xcb-proto {
	description = "XML-XCB protocol descriptions used by libxcb for the X11 protocol & extensions";
	website = "https://gitlab.freedesktop.org/xorg/proto/xcbproto";
	anitya = 13646;

	version# = "1.17.0";
	source = remoteTar {
		url = "https://xcb.freedesktop.org/dist/xcb-proto-"+version+".tar.gz";
		checksum = "_NtbKaJ_iyT7XiJz25mXQ7y-niTzE8sHPvLXZPcqtNoV_-vTzqkezJ8Hp2U1enCv";
		compress = gzip;
	};

	exec = make {};

	inputs = [ python ];
}

package xcb {
	description = "The X protocol C-language Binding";
	website = "https://xcb.freedesktop.org";
	anitya = 1767;

	version# = "1.17.0";
	source = remoteTar {
		url = "https://xcb.freedesktop.org/dist/libxcb-"+version+".tar.gz";
		checksum = "hjjsc79LpWM_hZjNWbDDS6qRQUXREjjekS6UbUsDq-RR1_AjgNDxhRvZf-1_kzDd";
		compress = gzip;
	};

	exec = make {};

	inputs = [
		python,
		pkgconf,

		xcb-proto,
		libXau,
	];

	runtime = [
		xcb-proto,
		libXau,
	];
}

package libxcb-keysyms {
	description = "standard X key constants and conversion to/from keycodes";
	website = "https://gitlab.freedesktop.org/xorg/lib/libxcb-keysyms";
	anitya = 5168;

	version# = "0.4.1";
	source = remoteTar {
		url = "https://xcb.freedesktop.org/dist/xcb-util-keysyms-"+version+".tar.gz";
		checksum = "-EEje12UEjtFBuIjb6Fy4cxEghV20BXwQ1BLvhtvSuVcrFkp_X-ZHRM48wAspXZ4";
		compress = gzip;
	};

	exec = make {};

	inputs = [
		pkgconf,

		xcb,
	];

	runtime = [ xcb ];
}

package libxcb-wm {
	description = "XCB client and window-manager helpers for ICCCM & EWMH";
	website = "https://gitlab.freedesktop.org/xorg/lib/libxcb-wm";
	anitya = 5170;

	version# = "0.4.2";
	source = remoteTar {
		url = "https://xcb.freedesktop.org/dist/xcb-util-wm-"+version+".tar.gz";
		checksum = "g0VZgMU9hcIgyXb3XxBR9xqsvUMBd9qt_Dbmwoj2h5y24pODr_S_D0DhRsuXUNjF";
		compress = gzip;
	};

	exec = make {};

	inputs = [
		m4,
		pkgconf,

		xcb,
	];

	runtime = [ xcb ];
}

package libxcb-util {
	description = "XCB utility libraries";
	website = "https://gitlab.freedesktop.org/xorg/lib/libxcb-util";
	anitya = 5165;

	version# = "0.4.1";
	source = remoteTar {
		url = "https://www.x.org/releases/individual/xcb/"+
			"xcb-util-"+version+".tar.gz";
		checksum = "YMXGQUQbF6PoEAGflvYnJYsLWjti6sL_ifY47wIXTNGVM3tQ8u41nkBYN4K1D5CD";
		compress = gzip;
	};

	exec = make {};

	inputs = [
		pkgconf,

		util-macros,
		xcb,
	];

	runtime = [ xcb ];
}

package libxcb-image {
	description = "XCB port of Xlib's XImage and XShmImage functions";
	website = "https://gitlab.freedesktop.org/xorg/lib/libxcb-image";
	anitya = 5168;

	version# = "0.4.1";
	source = remoteTar {
		url = "https://xcb.freedesktop.org/dist/xcb-util-image-"+version+".tar.gz";
		checksum = "47pvXmFwaUBZIrJ4CE9xjTQIFyxeqoNAL-DshlB11GZ_jjI3G1a6KF0K7mtBQ1E7";
		compress = gzip;
	};

	exec = make {};

	inputs = [
		pkgconf,

		libxcb-util,
	];

	runtime = [ libxcb-util ];
}

package libxcb-render-util {
	description = "XCB convenience functions for the Render extension";
	website = "https://gitlab.freedesktop.org/xorg/lib/libxcb-render-util";
	anitya = 5169;

	version# = "0.3.10";
	source = remoteTar {
		url = "https://www.x.org/releases/individual/xcb/"+
			"xcb-util-renderutil-"+version+".tar.gz";
		checksum = "n08L8PyCoOd7v2vb6fSVq5Pq6JtteXVh9K2wrQMTNwGMf_Fjpi6i3HWF-TMFSVTI";
		compress = gzip;
	};

	exec = make {};

	inputs = [
		pkgconf,

		util-macros,
		xcb,
	];

	runtime = [ xcb ];
}

package libX11 {
	description = `Core X11 protocol client library (aka "Xlib")`;
	website = "https://gitlab.freedesktop.org/xorg/lib/libx11";
	anitya = 1764;

	version# = "1.8.13";
	source = remoteGitLab {
		domain = "gitlab.freedesktop.org";
		suffix = "xorg/lib/libx11";
		ref = "libX11-"+version;
		checksum = "ARh-cuZY_U2v3DbPS1byc7ybh9NInZc-yav7SJiusk_C7408s058qWV83ocMd2pT";
	};

	exec = make {
		generate = "NOCONFIGURE=1 ./autogen.sh";

		configure = {
			"enable-static";
			"without-xmlto";
		};
	};

	inputs = [
		automake,
		libtool,
		pkgconf,

		util-macros,
		libxtrans,
		xorgproto,
		xcb,
	];

	runtime = [ xcb ];
}

package libXext {
	description = "Xlib-based library for common extensions to the X11 protocol";
	website = "https://gitlab.freedesktop.org/xorg/lib/libxext";
	anitya = 1774;

	version# = "1.3.7";
	source = remoteGitLab {
		domain = "gitlab.freedesktop.org";
		suffix = "xorg/lib/libxext";
		ref = "libXext-"+version;
		checksum = "-0wvUDaucLPLNOrK1pcKhHNoO-5nUqQyyw6JAbhx65gRjuMiNKKaF2_tcrbC_KNq";
	};

	exec = make {
		generate = "NOCONFIGURE=1 ./autogen.sh";
	};

	inputs = [
		automake,
		libtool,
		pkgconf,

		util-macros,
		libX11,
	];

	runtime = [ libX11 ];
}

package libXfixes {
	description = "Xlib-based library for the XFIXES Extension";
	website = "https://www.freedesktop.org/wiki/Software/FixesExt";
	anitya = 1775;

	version# = "6.0.2";
	source = remoteGitLab {
		domain = "gitlab.freedesktop.org";
		suffix = "xorg/lib/libxfixes";
		ref = "libXfixes-"+version;
		checksum = "_-kJfKZ7cE3NNeMr6NLSXCmsyP7MVEHVPLNfxatz2qBy3_fZJvPMQwZNOC9y6V5L";
	};

	exec = make {
		generate = "NOCONFIGURE=1 ./autogen.sh";
	};

	inputs = [
		automake,
		libtool,
		pkgconf,

		util-macros,
		xorgproto,
		libX11,
	];

	runtime = [ libX11 ];
}

package libXrender {
	description = "Xlib library for the Render Extension to the X11 protocol";
	website = "https://gitlab.freedesktop.org/xorg/lib/libxrender";
	anitya = 1789;

	version# = "0.9.12";
	source = remoteGitLab {
		domain = "gitlab.freedesktop.org";
		suffix = "xorg/lib/libxrender";
		ref = "libXrender-"+version;
		checksum = "s6nWn-r17X_W-7anaS7wIcq5_Levf9zAigwJDD9Klp-cCJTVDhLo7GufuVOrxVP0";
	};

	exec = make {
		generate = "NOCONFIGURE=1 ./autogen.sh";
	};

	inputs = [
		automake,
		libtool,
		pkgconf,

		util-macros,
		libX11,
	];

	runtime = [ libX11 ];
}

package libxshmfence {
	description = "shared memory 'SyncFence' synchronization primitive";
	website = "https://gitlab.freedesktop.org/xorg/lib/libxshmfence";
	anitya = 1792;

	version# = "1.3.3";
	source = remoteGitLab {
		domain = "gitlab.freedesktop.org";
		suffix = "xorg/lib/libxshmfence";
		ref = "libxshmfence-"+version;
		checksum = "JamExTPg81By2fs3vWdeo_dzlpBQeAwXr2sDXeHJqm9XBoLW5pamiD6FgAWtAKyA";
	};

	exec = make {
		generate = "NOCONFIGURE=1 ./autogen.sh";
	};

	inputs = [
		automake,
		libtool,
		pkgconf,

		util-macros,
		xorgproto,
	];
}

package libXxf86vm {
	description = "Xlib-based library for the XFree86-VidMode X extension";
	website = "https://gitlab.freedesktop.org/xorg/lib/libxxf86vm";
	anitya = 1799;

	version# = "1.1.7";
	source = remoteGitLab {
		domain = "gitlab.freedesktop.org";
		suffix = "xorg/lib/libxxf86vm";
		ref = "libXxf86vm-"+version;
		checksum = "mS4cgKWrwz6M1Lb6Qu4ZVh8Xn2Ca_4HXPxr3LDad4iYY1LecZfeLUPW1hkp6amX_";
	};

	exec = make {
		generate = "NOCONFIGURE=1 ./autogen.sh";
	};

	inputs = [
		automake,
		libtool,
		pkgconf,

		util-macros,
		libXext,
		xorgproto,
	];

	runtime = [ libXext ];
}

package libXrandr {
	description = "Xlib Resize, Rotate and Reflection (RandR) extension library";
	website = "https://gitlab.freedesktop.org/xorg/lib/libxrandr";
	anitya = 1788;

	version# = "1.5.5";
	source = remoteGitLab {
		domain = "gitlab.freedesktop.org";
		suffix = "xorg/lib/libxrandr";
		ref = "libXrandr-"+version;
		checksum = "OF7C7VC5MwnFue9UX5UnIkG1PIWvn9bBMq6d4mVyJJ_rcF0w4Kedn1lfxBsXEKAP";
	};

	exec = make {
		generate = "NOCONFIGURE=1 ./autogen.sh";
	};

	inputs = [
		automake,
		libtool,
		pkgconf,

		util-macros,
		libXext,
		libXrender,
		xorgproto,
	];

	runtime = [
		libXext,
		libXrender,
	];
}

package font-util {
	description = "X.Org font package creation/installation utilities";
	website = "https://gitlab.freedesktop.org/xorg/font/util";
	anitya = 15055;

	version# = "1.4.2";
	source = remoteGitLab {
		domain = "gitlab.freedesktop.org";
		suffix = "xorg/font/util";
		ref = "font-util-"+version;
		checksum = "YWiaIxkq-N2yNdbGa_RF1S0UkQq6xsgoRT73WZP2DOmyH_CJ0TAkpQjId657MQmh";
	};

	exec = make {
		generate = "NOCONFIGURE=1 ./autogen.sh";
	};

	inputs = [
		automake,
		libtool,
		pkgconf,

		util-macros,
	];
}

package libfontenc {
	description = "X font encoding library";
	website = "https://gitlab.freedesktop.org/xorg/lib/libfontenc";
	anitya = 1613;

	version# = "1.1.9";
	source = remoteGitLab {
		domain = "gitlab.freedesktop.org";
		suffix = "xorg/lib/libfontenc";
		ref = "libfontenc-"+version;
		checksum = "XqosXfbVwaoYzG9vVyRCl3eatwjASoJdLZsxQ37NN8S_jTyqNmbxpRSJGImJj7RS";
	};

	exec = make {
		generate = "NOCONFIGURE=1 ./autogen.sh";
	};

	inputs = [
		automake,
		libtool,
		pkgconf,

		util-macros,
		font-util,
		xorgproto,
	];
}

package libxkbfile {
	description = "XKB file handling routines";
	website = "http://www.x.org/wiki/XKB";
	anitya = 1781;

	version# = "1.2.0";
	source = remoteGitLab {
		domain = "gitlab.freedesktop.org";
		suffix = "xorg/lib/libxkbfile";
		ref = "libxkbfile-"+version;
		checksum = "WUtph1ab0AyATahlwljchBxZJcpjYrjyhCK9DW2VO0uXEXaN22GWmUaibcA83i_B";
	};

	exec = meson {};

	inputs = [ libX11 ];
	runtime = [ libX11 ];
}

package xkbcomp {
	description = "XKB keyboard description compiler";
	website = "http://www.x.org/wiki/XKB";
	anitya = 15018;

	version# = "1.5.0";
	source = remoteGitLab {
		domain = "gitlab.freedesktop.org";
		suffix = "xorg/app/xkbcomp";
		ref = "xkbcomp-"+version;
		checksum = "ttICW8ZPbljI-nw2kknvxFhwFoDK40iAMBeZDLAHYsHf3B6UPO_zc9TpzZYRRyZH";
	};

	exec = make {
		generate = "NOCONFIGURE=1 ./autogen.sh";
	};

	inputs = [
		automake,
		libtool,
		pkgconf,
		byacc,

		util-macros,
		libxkbfile,
	];

	runtime = [ libxkbfile ];
}

package libXfont2 {
	description = "X font handling library for server & utilities";
	website = "https://gitlab.freedesktop.org/xorg/lib/libxfont";
	anitya = 17165;

	version# = "2.0.9";
	source = remoteGitLab {
		domain = "gitlab.freedesktop.org";
		suffix = "xorg/lib/libxfont";
		ref = "libXfont2-"+version;
		checksum = "K9d4_rX3oTqGRgPUqi2S8eND-9mQ7oirt2PFMsyjXOYi9VSZC-_qH5Lh0Lwmk-c8";
	};

	exec = make {
		generate = "NOCONFIGURE=1 ./autogen.sh";
	};

	inputs = [
		automake,
		libtool,
		pkgconf,

		util-macros,
		freetype,
		xorgproto,
		libxtrans,
		libfontenc,
	];

	runtime = [
		freetype,
		libfontenc,
	];
}

package libxcvt {
	description = "VESA CVT standard timing modeline generation library & utility";
	website = "https://gitlab.freedesktop.org/xorg/lib/libxcvt";
	anitya = 235147;

	version# = "0.1.3";
	source = remoteGitLab {
		domain = "gitlab.freedesktop.org";
		suffix = "xorg/lib/libxcvt";
		ref = "libxcvt-"+version;
		checksum = "IfIA7SxlHMWh681e1AgYmZcRAfkZd5LlzmqcMRifNY5nNVRrUx_wnoaidAv0Yu03";
	};

	exec = meson {};
}

package libXdmcp {
	description = "X Display Manager Control Protocol library";
	website = "https://gitlab.freedesktop.org/xorg/lib/libxdmcp";
	anitya = 1772;

	version# = "1.1.5";
	source = remoteGitLab {
		domain = "gitlab.freedesktop.org";
		suffix = "xorg/lib/libxdmcp";
		ref = "libXdmcp-"+version;
		checksum = "N6AJSv9pmeBedFn8KuSIOUGvTken4rkypNWVE2KfPlliwkfIbhfXrt5YHZkBMUHp";
	};

	exec = make {
		generate = "NOCONFIGURE=1 ./autogen.sh";
	};

	inputs = [
		automake,
		libtool,
		pkgconf,

		util-macros,
		xorgproto,
	];
}

package xkeyboard-config {
	description = "the non-arch keyboard configuration database for X Window";
	website = "https://www.freedesktop.org/wiki/Software/XKeyboardConfig";
	anitya = 5191;

	version# = "2.48";
	source = remoteGitLab {
		domain = "gitlab.freedesktop.org";
		suffix = "xkeyboard-config/xkeyboard-config";
		ref = "xkeyboard-config-"+version;
		checksum = "_CxeFtwCaki-ZzoVtBgLnJ1p6tDJTAsfGmWJy867ij7equ5-lTKMV2YheE_Lbpo4";
	};

	exec = meson {};

	inputs = [ perl ];
}

package libpciaccess {
	description = "generic PCI access library";
	website = "https://gitlab.freedesktop.org/xorg/lib/libpciaccess";
	anitya = 1703;

	version# = "0.19";
	source = remoteGitLab {
		domain = "gitlab.freedesktop.org";
		suffix = "xorg/lib/libpciaccess";
		ref = "libpciaccess-"+version;
		checksum = "84H0c_U_7fMqo81bpuwyXGXtk4XvvFH_YK00UiOriv3YGsuAhmbo2IkFhmJnvu2x";
	};

	exec = meson {
		setup = {
			"zlib": "enabled";
		};
	};

	inputs = [ zlib ];
	runtime = [ zlib ];
}

package xserver {
	description = "X server";
	website = "https://gitlab.freedesktop.org/xorg/xserver";
	anitya = 5250;

	version# = "21.1.24";
	source = remoteGitLab {
		domain = "gitlab.freedesktop.org";
		suffix = "xorg/xserver";
		ref = "xorg-server-"+version;
		checksum = "ueBiwKIOHZkSmJPzxAeze_SJHt4QxEHQTk1kMkic-GYxC7Fs41ckwgVzcwr2N3ca";
	};

	exec = meson {
		setup = {
			"xorg": "true";
			"xephyr": "true";
			"xnest": "true";
			"ipv6": "false";

			"udev": "false";
			"udev_kms": "false";
			"glx": "false";

			// ../../usr/src/xserver/glamor/glamor_glx.c:24:10: fatal error: 'epoxy/glx.h' file not found
			"glamor": "false";
		};
	};

	inputs = [
		awk,

		xorgproto,
		libxtrans,
		libxshmfence,
		pixman,
		libbsd,
		xkbcomp,
		xkeyboard-config,
		libXfont2,
		dbus,
		font-util,
		libxcvt,
		libXext,
		libmd,
		libXdmcp,
		libtirpc,
		libxcb-util,
		libxcb-image,
		libxcb-wm,
		libxcb-keysyms,
		libxcb-render-util,
		libpciaccess,
		kernel-headers,
	];

	runtime = [
		xkbcomp,
		xkeyboard-config,

		xcb,
		pixman,
		libmd,
		libbsd,
		libtirpc,
		libxcvt,
		libXdmcp,
		libXfont2,
		libpciaccess,

		// Xephyr
		libxcb-image,
		libxcb-wm,
		libxcb-keysyms,
		libxcb-render-util,
	];
}

package xwayland {
	description = "Xwayland server";
	website = "https://gitlab.freedesktop.org/xorg/xserver";
	anitya = 180949;

	version# = "24.1.13";
	source = remoteGitLab {
		domain = "gitlab.freedesktop.org";
		suffix = "xorg/xserver";
		ref = "xwayland-"+version;
		checksum = "dZpEGlcPJ72TBCtnR1mvquvN4iUypGvGJ4tN9hpa-ljux28EkSCQRlQHLPRijz36";
	};

	bin = [ "bash" ];
	exec = meson {
		setup = {
			"ipv6": "false";
			"systemd_notify": "false";
		};
	};

	inputs = [
		bash,
		awk,

		mesa,
		libglvnd,
		libepoxy,
		xorgproto,
		wayland,
		wayland-protocols,
		libxtrans,
		libxshmfence,
		pixman,
		libbsd,
		xkbcomp,
		xkeyboard-config,
		libXfont2,
		font-util,
		libxcvt,
		libmd,
		libXdmcp,
		libtirpc,
		kernel-headers,
	];

	runtime = [
		xkbcomp,
		xkeyboard-config,

		mesa,
		libglvnd,
		libepoxy,
		pixman,
		libmd,
		libbsd,
		libtirpc,
		libxcvt,
		libXdmcp,
		libXfont2,
		libpciaccess,
	];
}
