Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pkgs/development/libraries/libjpeg-turbo/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ stdenv, fetchurl, fetchpatch, cmake, nasm, enableStatic ? false }:
{ stdenv, fetchurl, fetchpatch, cmake, nasm, enableStatic ? false, enableShared ? true }:

stdenv.mkDerivation rec {

Expand Down Expand Up @@ -34,6 +34,7 @@ stdenv.mkDerivation rec {

cmakeFlags = [
"-DENABLE_STATIC=${if enableStatic then "1" else "0"}"
"-DENABLE_SHARED=${if enableShared then "1" else "0"}"
];

doInstallCheck = true;
Expand Down
47 changes: 32 additions & 15 deletions pkgs/servers/x11/xorg/overrides.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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: {
Expand All @@ -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";
});
Expand All @@ -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
Expand All @@ -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" ];
Expand All @@ -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: {
Expand All @@ -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;

Expand All @@ -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;
});
Expand All @@ -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";
});
Expand All @@ -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: {
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -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" ];
Expand Down Expand Up @@ -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 ''
Expand Down Expand Up @@ -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
Expand Down
28 changes: 28 additions & 0 deletions pkgs/top-level/static.nix
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ in {
libressl = super.libressl.override {
buildShared = false;
};
libjpeg_turbo = super.libjpeg_turbo.override {
enableStatic = true;
enableShared = false;
};

darwin = super.darwin // {
libiconv = super.darwin.libiconv.override {
Expand Down Expand Up @@ -276,4 +280,28 @@ in {
libev = super.libev.override { static = true; };

libexecinfo = super.libexecinfo.override { enableShared = false; };

xorg = super.xorg.overrideScope' (xorgself: xorgsuper: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be preferably to introduce some kind of enableStatic option in the xorg derivations, if possible, but I guess that is difficult because they are "generated" and then overridden.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we can change the signature of a function while overriding...

In any case I'd rather see something like #83664 implemented.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's possible with something like

libXxf86dga = lib.makeOverrideable ({enableStatic, ... } @attrs: super.libXxf86dga.overrideAttrs(oldAttrs: {
} // attrs));

but yea, not really worth it.

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" ];
});
});
}