mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-26 04:43:09 +03:00
treewide: refactor to use libglvnd
* Implement libGL as a symlink package which uses libraries from libglvnd and headers from Mesa (since ones from libglvnd are outdated). * Use libGL_driver.driverLink treewide; add FHS paths where possible.
This commit is contained in:
parent
803e87aa1e
commit
6bf1421f13
@ -1,5 +1,5 @@
|
|||||||
{ stdenv, lib, fetchurl, libX11, pkgconfig, libXext, libdrm, libXfixes, wayland, libffi
|
{ stdenv, lib, fetchurl, libX11, pkgconfig, libXext, libdrm, libXfixes, wayland, libffi
|
||||||
, mesa_noglu
|
, libGL, libGL_driver
|
||||||
, minimal ? true, libva
|
, minimal ? true, libva
|
||||||
}:
|
}:
|
||||||
|
|
||||||
@ -17,11 +17,12 @@ stdenv.mkDerivation rec {
|
|||||||
nativeBuildInputs = [ pkgconfig ];
|
nativeBuildInputs = [ pkgconfig ];
|
||||||
|
|
||||||
buildInputs = [ libdrm ]
|
buildInputs = [ libdrm ]
|
||||||
++ lib.optionals (!minimal) [ libva libX11 libXext libXfixes wayland libffi mesa_noglu ];
|
++ lib.optionals (!minimal) [ libva libX11 libXext libXfixes wayland libffi libGL ];
|
||||||
# TODO: share libs between minimal and !minimal - perhaps just symlink them
|
# TODO: share libs between minimal and !minimal - perhaps just symlink them
|
||||||
|
|
||||||
configureFlags =
|
configureFlags =
|
||||||
[ "--with-drivers-path=${mesa_noglu.driverLink}/lib/dri" ] ++
|
# Add FHS paths for non-NixOS applications.
|
||||||
|
[ "--with-drivers-path=${libGL_driver.driverLink}/lib/dri:/usr/lib/dri:/usr/lib32/dri" ] ++
|
||||||
lib.optionals (!minimal) [ "--enable-glx" ];
|
lib.optionals (!minimal) [ "--enable-glx" ];
|
||||||
|
|
||||||
installFlags = [ "dummy_drv_video_ladir=$(out)/lib/dri" ];
|
installFlags = [ "dummy_drv_video_ladir=$(out)/lib/dri" ];
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{ stdenv, lib, fetchFromGitHub, autoreconfHook, pkgconfig
|
{ stdenv, lib, fetchFromGitHub, autoreconfHook, pkgconfig
|
||||||
, libXext, libdrm, libXfixes, wayland, libffi, libX11
|
, libXext, libdrm, libXfixes, wayland, libffi, libX11
|
||||||
, libGL
|
, libGL, libGL_driver
|
||||||
, minimal ? true, libva
|
, minimal ? true, libva
|
||||||
}:
|
}:
|
||||||
|
|
||||||
@ -27,7 +27,8 @@ stdenv.mkDerivation rec {
|
|||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
configureFlags = [
|
configureFlags = [
|
||||||
"--with-drivers-path=${libGL.driverLink}/lib/dri"
|
# Add FHS paths for non-NixOS applications.
|
||||||
|
"--with-drivers-path=${libGL_driver.driverLink}/lib/dri:/usr/lib/dri:/usr/lib32/dri"
|
||||||
] ++ lib.optionals (!minimal) [ "--enable-glx" ];
|
] ++ lib.optionals (!minimal) [ "--enable-glx" ];
|
||||||
|
|
||||||
installFlags = [
|
installFlags = [
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
{ stdenv, fetchurl, pkgconfig, xorg, libGL }:
|
{ stdenv, fetchurl, pkgconfig, xorg, libGL_driver }:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
name = "libvdpau-1.1.1";
|
name = "libvdpau-${version}";
|
||||||
|
version = "1.1.1";
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "https://people.freedesktop.org/~aplattner/vdpau/${name}.tar.bz2";
|
url = "https://people.freedesktop.org/~aplattner/vdpau/${name}.tar.bz2";
|
||||||
@ -16,7 +17,7 @@ stdenv.mkDerivation rec {
|
|||||||
propagatedBuildInputs = [ xorg.libX11 ];
|
propagatedBuildInputs = [ xorg.libX11 ];
|
||||||
|
|
||||||
configureFlags = stdenv.lib.optional stdenv.isLinux
|
configureFlags = stdenv.lib.optional stdenv.isLinux
|
||||||
"--with-module-dir=${libGL.driverLink}/lib/vdpau";
|
"--with-module-dir=${libGL_driver.driverLink}/lib/vdpau";
|
||||||
|
|
||||||
installFlags = [ "moduledir=$(out)/lib/vdpau" ];
|
installFlags = [ "moduledir=$(out)/lib/vdpau" ];
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
{ stdenv, fetchurl, pkgconfig, mesa_noglu }:
|
{ stdenv, fetchurl, pkgconfig, libGL }:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
name = "glu-9.0.0";
|
name = "glu-${version}";
|
||||||
|
version = "9.0.0";
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "ftp://ftp.freedesktop.org/pub/mesa/glu/${name}.tar.bz2";
|
url = "ftp://ftp.freedesktop.org/pub/mesa/glu/${name}.tar.bz2";
|
||||||
@ -12,7 +13,7 @@ stdenv.mkDerivation rec {
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
nativeBuildInputs = [ pkgconfig ];
|
nativeBuildInputs = [ pkgconfig ];
|
||||||
propagatedBuildInputs = [ mesa_noglu ];
|
propagatedBuildInputs = [ libGL ];
|
||||||
|
|
||||||
outputs = [ "out" "dev" ];
|
outputs = [ "out" "dev" ];
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ let
|
|||||||
branch = head (splitString "." version);
|
branch = head (splitString "." version);
|
||||||
in
|
in
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
let self = stdenv.mkDerivation {
|
||||||
name = "mesa-noglu-${version}";
|
name = "mesa-noglu-${version}";
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
@ -227,6 +227,37 @@ stdenv.mkDerivation {
|
|||||||
passthru = {
|
passthru = {
|
||||||
inherit libdrm version;
|
inherit libdrm version;
|
||||||
inherit (libglvnd) driverLink;
|
inherit (libglvnd) driverLink;
|
||||||
|
|
||||||
|
stubs = stdenv.mkDerivation {
|
||||||
|
name = "libGL-${libglvnd.version}";
|
||||||
|
outputs = [ "out" "dev" ];
|
||||||
|
|
||||||
|
# Use stub libraries from libglvnd and headers from Mesa.
|
||||||
|
buildCommand = ''
|
||||||
|
ln -s ${libglvnd.out} $out
|
||||||
|
mkdir -p $dev/{,lib/pkgconfig,nix-support}
|
||||||
|
echo "$out" > $dev/nix-support/propagated-build-inputs
|
||||||
|
ln -s ${self.dev}/include $dev/include
|
||||||
|
|
||||||
|
genPkgConfig() {
|
||||||
|
local name="$1"
|
||||||
|
local lib="$2"
|
||||||
|
|
||||||
|
cat <<EOF >$dev/lib/pkgconfig/$name.pc
|
||||||
|
Name: $name
|
||||||
|
Description: $lib library
|
||||||
|
Version: ${self.version}
|
||||||
|
Libs: -L${libglvnd.out}/lib -l$lib
|
||||||
|
Cflags: -I${self.dev}/include
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
genPkgConfig gl GL
|
||||||
|
genPkgConfig egl EGL
|
||||||
|
genPkgConfig glesv1_cm GLESv1_CM
|
||||||
|
genPkgConfig glesv2 GLESv2
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
meta = with stdenv.lib; {
|
||||||
@ -236,4 +267,5 @@ stdenv.mkDerivation {
|
|||||||
platforms = platforms.linux;
|
platforms = platforms.linux;
|
||||||
maintainers = with maintainers; [ eduarrrd vcunat ];
|
maintainers = with maintainers; [ eduarrrd vcunat ];
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
in self
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{stdenv, fetchurl, ruby, opencl-headers, libGL }:
|
{stdenv, fetchurl, ruby, opencl-headers, libGL_driver }:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
name = "ocl-icd-${version}";
|
name = "ocl-icd-${version}";
|
||||||
@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
|
|||||||
buildInputs = [ opencl-headers ];
|
buildInputs = [ opencl-headers ];
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
sed -i 's,"/etc/OpenCL/vendors","${libGL.driverLink}/etc/OpenCL/vendors",g' ocl_icd_loader.c
|
sed -i 's,"/etc/OpenCL/vendors","${libGL_driver.driverLink}/etc/OpenCL/vendors",g' ocl_icd_loader.c
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
meta = with stdenv.lib; {
|
||||||
|
@ -76,7 +76,6 @@ stdenv.mkDerivation rec {
|
|||||||
icu = icu.out;
|
icu = icu.out;
|
||||||
libXfixes = libXfixes.out;
|
libXfixes = libXfixes.out;
|
||||||
glibc = stdenv.cc.libc.out;
|
glibc = stdenv.cc.libc.out;
|
||||||
openglDriver = if libGLSupported then libGL.driverLink else "/no-such-path";
|
|
||||||
})
|
})
|
||||||
(fetchpatch {
|
(fetchpatch {
|
||||||
name = "fix-medium-font.patch";
|
name = "fix-medium-font.patch";
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{ stdenv, fetchgit, fetchFromGitHub, cmake, pkgconfig, git, python3,
|
{ stdenv, fetchgit, fetchFromGitHub, cmake, pkgconfig, git, python3,
|
||||||
python3Packages, glslang, spirv-tools, x11, libxcb, libXrandr,
|
python3Packages, glslang, spirv-tools, x11, libxcb, libXrandr,
|
||||||
libXext, wayland, libGL, makeWrapper }:
|
libXext, wayland, libGL_driver, makeWrapper }:
|
||||||
|
|
||||||
let
|
let
|
||||||
version = "1.0.61.1";
|
version = "1.0.61.1";
|
||||||
@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
cmakeFlags = [
|
cmakeFlags = [
|
||||||
"-DBUILD_WSI_MIR_SUPPORT=OFF"
|
"-DBUILD_WSI_MIR_SUPPORT=OFF"
|
||||||
"-DFALLBACK_DATA_DIRS=${libGL.driverLink}/share:/usr/local/share:/usr/share"
|
"-DFALLBACK_DATA_DIRS=${libGL_driver.driverLink}/share:/usr/local/share:/usr/share"
|
||||||
];
|
];
|
||||||
|
|
||||||
outputs = [ "out" "dev" "demos" ];
|
outputs = [ "out" "dev" "demos" ];
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
|
|
||||||
let
|
let
|
||||||
packages = [
|
packages = [
|
||||||
stdenv.cc.cc zlib glib xorg.libX11 libxkbcommon libXmu libXi libXext
|
stdenv.cc.cc zlib glib xorg.libX11 libxkbcommon libXmu libXi libXext libGL
|
||||||
];
|
];
|
||||||
libPath = "${stdenv.lib.makeLibraryPath packages}:${libGL.driverLink}/lib";
|
libPath = "${stdenv.lib.makeLibraryPath packages}";
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
name = "genymotion-${version}";
|
name = "genymotion-${version}";
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{ stdenv, fetchFromGitHub, libpng, pkgconfig, SDL, freetype, zlib, mesa }:
|
{ stdenv, fetchFromGitHub, libpng, pkgconfig, SDL, freetype, zlib }:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ stdenv.mkDerivation ((lib.optionalAttrs (! isNull buildScript) {
|
|||||||
++ lib.optionals openclSupport [ pkgs.opencl-headers pkgs.ocl-icd ]
|
++ lib.optionals openclSupport [ pkgs.opencl-headers pkgs.ocl-icd ]
|
||||||
++ lib.optionals xmlSupport [ pkgs.libxml2 pkgs.libxslt ]
|
++ lib.optionals xmlSupport [ pkgs.libxml2 pkgs.libxslt ]
|
||||||
++ lib.optionals tlsSupport [ pkgs.openssl pkgs.gnutls ]
|
++ lib.optionals tlsSupport [ pkgs.openssl pkgs.gnutls ]
|
||||||
++ lib.optionals openglSupport [ pkgs.libGLU_combined pkgs.libGL.osmesa pkgs.libdrm ]
|
++ lib.optionals openglSupport [ pkgs.libGLU_combined pkgs.mesa_noglu.osmesa pkgs.libdrm ]
|
||||||
++ (with pkgs.xorg; [
|
++ (with pkgs.xorg; [
|
||||||
libX11 libXi libXcursor libXrandr libXrender libXxf86vm libXcomposite libXext
|
libX11 libXi libXcursor libXrandr libXrender libXxf86vm libXcomposite libXext
|
||||||
])));
|
])));
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{ stdenv, fetchurl, elfutils, libGL
|
{ stdenv, fetchurl, elfutils
|
||||||
, xorg, patchelf, openssl, libdrm, libudev
|
, xorg, patchelf, openssl, libdrm, libudev
|
||||||
, libxcb, libxshmfence, epoxy, perl, zlib
|
, libxcb, libxshmfence, epoxy, perl, zlib
|
||||||
, fetchFromGitHub, ncurses
|
, fetchFromGitHub, ncurses
|
||||||
@ -13,8 +13,6 @@ let
|
|||||||
|
|
||||||
kernelDir = if libsOnly then null else kernel.dev;
|
kernelDir = if libsOnly then null else kernel.dev;
|
||||||
|
|
||||||
inherit (libGL) driverLink;
|
|
||||||
|
|
||||||
bitness = if stdenv.is64bit then "64" else "32";
|
bitness = if stdenv.is64bit then "64" else "32";
|
||||||
|
|
||||||
libArch =
|
libArch =
|
||||||
|
@ -10498,60 +10498,47 @@ with pkgs;
|
|||||||
## libGL/libGLU/Mesa stuff
|
## libGL/libGLU/Mesa stuff
|
||||||
|
|
||||||
# Default libGL implementation, should provide headers and libGL.so/libEGL.so/... to link agains them
|
# Default libGL implementation, should provide headers and libGL.so/libEGL.so/... to link agains them
|
||||||
# Default implementation is `mesa`, but can be eventually replaced with `libglvnd`,
|
libGL = libGLDarwinOr mesa_noglu.stubs;
|
||||||
# or other runtime dispatcher
|
|
||||||
libGL = mesa_noglu;
|
|
||||||
|
|
||||||
# Default libGLU
|
# Default libGLU
|
||||||
libGLU = mesa_glu;
|
libGLU = libGLDarwinOr mesa_glu;
|
||||||
|
|
||||||
# Combined derivation, contains both libGL and libGLU
|
# Combined derivation, contains both libGL and libGLU
|
||||||
# Please, avoid using this attribute. It was meant as transitional hack
|
# Please, avoid using this attribute. It was meant as transitional hack
|
||||||
# for packages that assume that libGLU and libGL live in the same prefix.
|
# for packages that assume that libGLU and libGL live in the same prefix.
|
||||||
# libGLU_combined propagates both libGL and libGLU
|
# libGLU_combined propagates both libGL and libGLU
|
||||||
libGLU_combined = mesa;
|
libGLU_combined = libGLDarwinOr (buildEnv {
|
||||||
|
name = "libGLU-combined";
|
||||||
|
paths = [ libGL libGLU ];
|
||||||
|
extraOutputsToInstall = [ "dev" ];
|
||||||
|
});
|
||||||
|
|
||||||
# Default derivation with libGL.so.1 to link into /run/opengl-drivers (if need)
|
# Default derivation with libGL.so.1 to link into /run/opengl-drivers (if need)
|
||||||
libGL_driver = mesa_drivers;
|
libGL_driver = libGLDarwinOr mesa_drivers;
|
||||||
|
|
||||||
libGLSupported = lib.elem system lib.platforms.mesaPlatforms;
|
libGLSupported = lib.elem system lib.platforms.mesaPlatforms;
|
||||||
|
|
||||||
libGLDarwinOr = alternative: if stdenv.isDarwin
|
libGLDarwin = callPackage ../development/libraries/mesa-darwin {
|
||||||
then callPackage ../development/libraries/mesa-darwin {
|
|
||||||
inherit (darwin.apple_sdk.frameworks) OpenGL;
|
inherit (darwin.apple_sdk.frameworks) OpenGL;
|
||||||
inherit (darwin.apple_sdk.libs) Xplugin;
|
inherit (darwin.apple_sdk.libs) Xplugin;
|
||||||
inherit (darwin) apple_sdk;
|
inherit (darwin) apple_sdk;
|
||||||
}
|
};
|
||||||
else alternative;
|
|
||||||
|
|
||||||
# FIXME: should be `libGL = libGLDarwinOr mesa_nonglu` but this change cause mass rebuild,
|
libGLDarwinOr = alternative: if stdenv.isDarwin then libGLDarwin else alternative;
|
||||||
# until all packages will refer to libGL/GLU/GLU combined
|
|
||||||
mesa_noglu = libGLDarwinOr (callPackage ../development/libraries/mesa {
|
mesa_noglu = callPackage ../development/libraries/mesa {
|
||||||
# makes it slower, but during runtime we link against just mesa_drivers
|
# makes it slower, but during runtime we link against just mesa_drivers
|
||||||
# through /run/opengl-driver*, which is overriden according to config.grsecurity
|
# through /run/opengl-driver*, which is overriden according to config.grsecurity
|
||||||
# grsecEnabled = true; # no more support in nixpkgs ATM
|
# grsecEnabled = true; # no more support in nixpkgs ATM
|
||||||
});
|
};
|
||||||
|
|
||||||
mesa_glu = libGLDarwinOr (callPackage ../development/libraries/mesa-glu { });
|
mesa_glu = callPackage ../development/libraries/mesa-glu { };
|
||||||
mesa_drivers = libGLDarwinOr (
|
mesa_drivers =
|
||||||
let mo = mesa_noglu.override {
|
let mo = mesa_noglu.override {
|
||||||
grsecEnabled = config.grsecurity or false;
|
grsecEnabled = config.grsecurity or false;
|
||||||
enableTextureFloats = true;
|
enableTextureFloats = true;
|
||||||
};
|
};
|
||||||
in mo.drivers
|
in mo.drivers;
|
||||||
);
|
|
||||||
|
|
||||||
# Please, avoid using this attribute. It was meant as transitional hack
|
|
||||||
# for packages that assume that libGLU and libGL live in the same prefix.
|
|
||||||
# Otherwise it's better to use mesa_glu or mesa_noglu, depending on whether
|
|
||||||
# you need libGLU or not (_glu propagates _noglu).
|
|
||||||
mesa = libGLDarwinOr (buildEnv {
|
|
||||||
name = "mesa-${mesa_noglu.version}";
|
|
||||||
paths = [ mesa_noglu.dev mesa_noglu.out mesa_glu mesa_glu.dev ];
|
|
||||||
meta = {
|
|
||||||
platforms = lib.platforms.unix;
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
## End libGL/libGLU/Mesa stuff
|
## End libGL/libGLU/Mesa stuff
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user