nixpkgs/pkgs/servers/x11/xorg/overrides.nix

251 lines
6.9 KiB
Nix

{ args, xorg }:
let
setMalloc0ReturnsNullCrossCompiling = ''
if test -n "$crossConfig"; then
configureFlags="$configureFlags --enable-malloc0returnsnull";
fi
'';
gitRelease = { libName, version, rev, sha256 } : attrs : attrs // {
name = libName + "-" + version;
src = args.fetchgit {
url = git://anongit.freedesktop.org/xorg/lib/ + libName;
inherit rev sha256;
};
buildInputs = attrs.buildInputs ++ [ xorg.utilmacros ];
preConfigure = (attrs.preConfigure or "") + "\n./autogen.sh";
};
compose = f: g: x: f (g x);
in
{
encodings = attrs: attrs // {
buildInputs = attrs.buildInputs ++ [ xorg.mkfontscale ];
};
fontcursormisc = attrs: attrs // {
buildInputs = attrs.buildInputs ++ [ xorg.mkfontscale ];
};
fontmiscmisc = attrs: attrs // {
postInstall =
''
ALIASFILE=${xorg.fontalias}/share/fonts/X11/misc/fonts.alias
test -f $ALIASFILE
ln -s $ALIASFILE $out/lib/X11/fonts/misc/fonts.alias
'';
};
imake = attrs: attrs // {
inherit (xorg) xorgcffiles;
x11BuildHook = ./imake.sh;
patches = [./imake.patch];
};
mkfontdir = attrs: attrs // {
preBuild = "substituteInPlace mkfontdir.in --replace @bindir@ ${xorg.mkfontscale}/bin";
};
libxcb = attrs : attrs // {
nativeBuildInputs = [ args.python ];
};
xcbproto = attrs : attrs // {
nativeBuildInputs = [ args.python ];
};
libpciaccess = attrs : attrs // {
patches = [ ./libpciaccess-apple.patch ];
};
libX11 = attrs: attrs // {
preConfigure = setMalloc0ReturnsNullCrossCompiling;
postInstall =
''
# Remove useless DocBook XML files.
rm -rf $out/share/doc
'';
};
libXxf86vm = attrs: attrs // {
preConfigure = setMalloc0ReturnsNullCrossCompiling;
};
libXrandr = attrs: attrs // {
preConfigure = setMalloc0ReturnsNullCrossCompiling;
propagatedBuildInputs = [xorg.libXrender];
};
# Propagate some build inputs because of header file dependencies.
# Note: most of these are in Requires.private, so maybe builder.sh
# should propagate them automatically.
libXt = attrs: attrs // {
preConfigure = setMalloc0ReturnsNullCrossCompiling;
propagatedBuildInputs = [ xorg.libSM ];
};
compositeproto = attrs: attrs // {
propagatedBuildInputs = [ xorg.fixesproto ];
};
libXcomposite = attrs: attrs // {
propagatedBuildInputs = [ xorg.libXfixes ];
};
libXaw = attrs: attrs // {
propagatedBuildInputs = [ xorg.libXmu ];
};
libXft = attrs: attrs // {
propagatedBuildInputs = [ xorg.libXrender args.freetype args.fontconfig ];
preConfigure = setMalloc0ReturnsNullCrossCompiling;
};
libXext = attrs: attrs // {
propagatedBuildInputs = [ xorg.xproto xorg.libXau ];
preConfigure = setMalloc0ReturnsNullCrossCompiling;
};
libSM = attrs: attrs
// { propagatedBuildInputs = [ xorg.libICE ]; };
libXi = gitRelease {
libName = "libXi";
version = "1.7.1.91";
rev = "661c45ca17c434dbd342a46fd3fb813852ae0ca9";
sha256 = "01wx8fgjjfqm0sm9anj6rmz72yvjyb4y3ifjk2q4ixd7pdp63bx6";
};
libXrender = attrs: attrs
// { preConfigure = setMalloc0ReturnsNullCrossCompiling; };
libXvMC = attrs: attrs
// { buildInputs = attrs.buildInputs ++ [xorg.renderproto]; };
libXpm = attrs: attrs // {
patchPhase = "sed -i '/USE_GETTEXT_TRUE/d' sxpm/Makefile.in cxpm/Makefile.in";
};
setxkbmap = attrs: attrs // {
postInstall =
''
mkdir -p $out/share
ln -sfn ${args.xkeyboard_config}/etc/X11 $out/share/X11
'';
};
utilmacros = attrs: attrs // { # not needed for releases, we propagate the needed tools
propagatedBuildInputs = with args; [ automake autoconf libtool ];
};
x11perf = attrs: attrs // {
buildInputs = attrs.buildInputs ++ [ args.freetype args.fontconfig ];
};
xf86inputevdev = attrs: attrs // {
preBuild = "sed -e '/motion_history_proc/d; /history_size/d;' -i src/*.c";
installFlags = "sdkdir=\${out}/include/xorg";
};
xf86inputjoystick = attrs: attrs // {
installFlags = "sdkdir=\${out}/include/xorg";
};
xf86inputsynaptics = attrs: attrs // {
buildInputs = attrs.buildInputs ++ [args.mtdev];
installFlags = "sdkdir=\${out}/include/xorg configdir=\${out}/include/xorg";
};
xf86inputvmmouse = attrs: attrs // {
configureFlags = [
"--sysconfdir=$(out)/etc"
"--with-xorg-conf-dir=$(out)/share/X11/xorg.conf.d"
"--with-udev-rules-dir=$(out)/lib/udev/rules.d"
];
};
xf86videovmware = attrs: attrs // {
buildInputs = attrs.buildInputs ++ [ args.mesa_drivers ]; # for libxatracker
};
xdriinfo = attrs: attrs // {
buildInputs = attrs.buildInputs ++ [args.mesa];
};
xvinfo = attrs: attrs // {
buildInputs = attrs.buildInputs ++ [xorg.libXext];
};
xkbcomp = attrs: attrs // {
NIX_CFLAGS_COMPILE = "-DDFLT_XKB_CONFIG_ROOT=\".\"";
};
xkeyboardconfig = attrs: attrs // {
buildInputs = attrs.buildInputs ++ [args.intltool];
};
xorgserver = with xorg; attrs: attrs // {
configureFlags = [
"--enable-xcsecurity" # enable SECURITY extension
"--with-default-font-path= " # there were only paths containing "${prefix}",
# and there are no fonts in this package anyway
];
patches = [./xorgserver-dri-path.patch ./xorgserver-xkbcomp-path.patch];
buildInputs = attrs.buildInputs ++ [ xtrans ];
propagatedBuildInputs =
[ args.zlib args.udev args.mesa args.dbus.libs
xf86bigfontproto glproto xf86driproto
compositeproto scrnsaverproto resourceproto
xf86dgaproto
dmxproto /*libdmx not used*/ xf86vidmodeproto
recordproto libXext pixman libXfont
damageproto xcmiscproto bigreqsproto
libpciaccess inputproto xextproto randrproto renderproto
dri2proto kbproto xineramaproto resourceproto scrnsaverproto videoproto
];
postInstall =
''
rm -fr $out/share/X11/xkb/compiled
ln -s /var/tmp $out/share/X11/xkb/compiled
'';
passthru.version = (builtins.parseDrvName attrs.name).version; # needed by virtualbox guest additions
};
lndir = attrs: attrs // {
preConfigure = ''
substituteInPlace lndir.c \
--replace 'n_dirs--;' ""
'';
};
twm = attrs: attrs // {
nativeBuildInputs = [args.bison args.flex];
};
xcursorthemes = attrs: attrs // {
buildInputs = attrs.buildInputs ++ [xorg.xcursorgen];
configureFlags = "--with-cursordir=$(out)/share/icons";
};
xinput = attrs: attrs // {
propagatedBuildInputs = [xorg.libXfixes];
};
xinit = attrs: attrs // {
configureFlags = "--with-xserver=${xorg.xorgserver}/bin/X";
propagatedBuildInputs = [ xorg.xauth ];
prePatch = ''
sed -i 's|^defaultserverargs="|&-logfile \"$HOME/.xorg.log\"|p' startx.cpp
'';
};
xf86videointel = attrs: attrs // {
buildInputs = attrs.buildInputs ++ [xorg.libXfixes];
};
xwd = attrs: attrs // {
buildInputs = attrs.buildInputs ++ [xorg.libXt];
};
}