xorg: fix static build

This commit is contained in:
Symphorien Gibol 2020-07-01 23:31:14 +02:00
parent 1aa45698d7
commit 80ba806339
2 changed files with 56 additions and 15 deletions

View file

@ -105,7 +105,7 @@ self: super:
rm -rf $out/share/doc
'';
CPP = stdenv.lib.optionalString stdenv.isDarwin "clang -E -";
propagatedBuildInputs = [ self.xorgproto ];
propagatedBuildInputs = attrs.propagatedBuildInputs or [] ++ [ self.xorgproto ];
});
libAppleWM = super.libAppleWM.overrideAttrs (attrs: {
@ -117,7 +117,7 @@ self: super:
libXau = super.libXau.overrideAttrs (attrs: {
outputs = [ "out" "dev" ];
propagatedBuildInputs = [ self.xorgproto ];
propagatedBuildInputs = attrs.propagatedBuildInputs or [] ++ [ self.xorgproto ];
});
libXdmcp = super.libXdmcp.overrideAttrs (attrs: {
@ -126,7 +126,7 @@ self: super:
libXfont = super.libXfont.overrideAttrs (attrs: {
outputs = [ "out" "dev" ];
propagatedBuildInputs = [ freetype ]; # propagate link reqs. like bzip2
propagatedBuildInputs = attrs.propagatedBuildInputs or [] ++ [ freetype ]; # propagate link reqs. like bzip2
# prevents "misaligned_stack_error_entering_dyld_stub_binder"
configureFlags = lib.optional isDarwin "CFLAGS=-O0";
});
@ -136,6 +136,22 @@ self: super:
configureFlags = attrs.configureFlags or []
++ malloc0ReturnsNullCrossFlag;
});
libXxf86dga = super.libXxf86dga.overrideAttrs (attrs: {
configureFlags = attrs.configureFlags or []
++ malloc0ReturnsNullCrossFlag;
});
libXxf86misc = super.libXxf86misc.overrideAttrs (attrs: {
configureFlags = attrs.configureFlags or []
++ malloc0ReturnsNullCrossFlag;
});
libdmx = super.libdmx.overrideAttrs (attrs: {
configureFlags = attrs.configureFlags or []
++ malloc0ReturnsNullCrossFlag;
});
xdpyinfo = super.xdpyinfo.overrideAttrs (attrs: {
configureFlags = attrs.configureFlags or []
++ malloc0ReturnsNullCrossFlag;
});
# Propagate some build inputs because of header file dependencies.
# Note: most of these are in Requires.private, so maybe builder.sh
@ -146,7 +162,7 @@ self: super:
'';
configureFlags = attrs.configureFlags or []
++ malloc0ReturnsNullCrossFlag;
propagatedBuildInputs = [ self.libSM ];
propagatedBuildInputs = attrs.propagatedBuildInputs or [] ++ [ self.libSM ];
depsBuildBuild = [ buildPackages.stdenv.cc ];
CPP = if stdenv.isDarwin then "clang -E -" else "${stdenv.cc.targetPrefix}cc -E -";
outputs = [ "out" "dev" "devdoc" ];
@ -166,12 +182,12 @@ self: super:
libXcomposite = super.libXcomposite.overrideAttrs (attrs: {
outputs = [ "out" "dev" ];
propagatedBuildInputs = [ self.libXfixes ];
propagatedBuildInputs = attrs.propagatedBuildInputs or [] ++ [ self.libXfixes ];
});
libXaw = super.libXaw.overrideAttrs (attrs: {
outputs = [ "out" "dev" "devdoc" ];
propagatedBuildInputs = [ self.libXmu ];
propagatedBuildInputs = attrs.propagatedBuildInputs or [] ++ [ self.libXmu ];
});
libXcursor = super.libXcursor.overrideAttrs (attrs: {
@ -184,7 +200,7 @@ self: super:
libXft = super.libXft.overrideAttrs (attrs: {
outputs = [ "out" "dev" ];
propagatedBuildInputs = [ self.libXrender freetype fontconfig ];
propagatedBuildInputs = attrs.propagatedBuildInputs or [] ++ [ self.libXrender freetype fontconfig ];
configureFlags = attrs.configureFlags or []
++ malloc0ReturnsNullCrossFlag;
@ -208,7 +224,7 @@ self: super:
libXext = super.libXext.overrideAttrs (attrs: {
outputs = [ "out" "dev" "man" "doc" ];
propagatedBuildInputs = [ self.xorgproto self.libXau ];
propagatedBuildInputs = attrs.propagatedBuildInputs or [] ++ [ self.xorgproto self.libXau ];
configureFlags = attrs.configureFlags or []
++ malloc0ReturnsNullCrossFlag;
});
@ -219,7 +235,7 @@ self: super:
libXi = super.libXi.overrideAttrs (attrs: {
outputs = [ "out" "dev" "man" "doc" ];
propagatedBuildInputs = [ self.libXfixes ];
propagatedBuildInputs = attrs.propagatedBuildInputs or [] ++ [ self.libXfixes ];
configureFlags = stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform)
"xorg_cv_malloc0_returns_null=no";
});
@ -239,19 +255,19 @@ self: super:
outputs = [ "out" "dev" ];
configureFlags = attrs.configureFlags or []
++ malloc0ReturnsNullCrossFlag;
propagatedBuildInputs = [self.libXrender];
propagatedBuildInputs = attrs.propagatedBuildInputs or [] ++ [ self.libXrender ];
});
libSM = super.libSM.overrideAttrs (attrs: {
outputs = [ "out" "dev" "doc" ];
propagatedBuildInputs = [ self.libICE ];
propagatedBuildInputs = attrs.propagatedBuildInputs or [] ++ [ self.libICE ];
});
libXrender = super.libXrender.overrideAttrs (attrs: {
outputs = [ "out" "dev" "doc" ];
configureFlags = attrs.configureFlags or []
++ malloc0ReturnsNullCrossFlag;
propagatedBuildInputs = [ self.xorgproto ];
propagatedBuildInputs = attrs.propagatedBuildInputs or [] ++ [ self.xorgproto ];
});
libXres = super.libXres.overrideAttrs (attrs: {
@ -319,7 +335,7 @@ self: super:
});
utilmacros = super.utilmacros.overrideAttrs (attrs: { # not needed for releases, we propagate the needed tools
propagatedBuildInputs = [ automake autoconf libtool ];
propagatedBuildInputs = attrs.propagatedBuildInputs or [] ++ [ automake autoconf libtool ];
});
x11perf = super.x11perf.overrideAttrs (attrs: {
@ -558,6 +574,7 @@ self: super:
xorgproto = super.xorgproto.overrideAttrs (attrs: {
buildInputs = [];
propagatedBuildInputs = [];
nativeBuildInputs = attrs.nativeBuildInputs ++ [ meson ninja ];
# adds support for printproto needed for libXp
mesonFlags = [ "-Dlegacy=true" ];
@ -626,7 +643,7 @@ self: super:
then {
outputs = [ "out" "dev" ];
buildInputs = commonBuildInputs ++ [ libdrm mesa ];
propagatedBuildInputs = [ libpciaccess epoxy ] ++ commonPropagatedBuildInputs ++ lib.optionals stdenv.isLinux [
propagatedBuildInputs = attrs.propagatedBuildInputs or [] ++ [ libpciaccess epoxy ] ++ commonPropagatedBuildInputs ++ lib.optionals stdenv.isLinux [
udev
];
prePatch = stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
@ -755,7 +772,7 @@ self: super:
"--with-launchdaemons-dir=\${out}/LaunchDaemons"
"--with-launchagents-dir=\${out}/LaunchAgents"
];
propagatedBuildInputs = [ self.xauth ]
propagatedBuildInputs = attrs.propagatedBuildInputs or [] ++ [ self.xauth ]
++ lib.optionals isDarwin [ self.libX11 self.xorgproto ];
prePatch = ''
sed -i 's|^defaultserverargs="|&-logfile \"$HOME/.xorg.log\"|p' startx.cpp

View file

@ -280,4 +280,28 @@ in {
libev = super.libev.override { static = true; };
libexecinfo = super.libexecinfo.override { enableShared = false; };
xorg = super.xorg.overrideScope' (xorgself: xorgsuper: {
libX11 = xorgsuper.libX11.overrideAttrs (attrs: {
depsBuildBuild = attrs.depsBuildBuild ++ [ (self.buildPackages.stdenv.cc.libc.static or null) ];
});
xauth = xorgsuper.xauth.overrideAttrs (attrs: {
# missing transitive dependencies
preConfigure = attrs.preConfigure or "" + ''
export NIX_CFLAGS_LINK="$NIX_CFLAGS_LINK -lxcb -lXau -lXdmcp"
'';
});
xdpyinfo = xorgsuper.xdpyinfo.overrideAttrs (attrs: {
# missing transitive dependencies
preConfigure = attrs.preConfigure or "" + ''
export NIX_CFLAGS_LINK="$NIX_CFLAGS_LINK -lXau -lXdmcp"
'';
});
libxcb = xorgsuper.libxcb.overrideAttrs (attrs: {
configureFlags = attrs.configureFlags ++ [ "--disable-shared" ];
});
libXi= xorgsuper.libXi.overrideAttrs (attrs: {
configureFlags = attrs.configureFlags ++ [ "--disable-shared" ];
});
});
}