Merge remote-tracking branch 'upstream/master' into staging

This commit is contained in:
Tuomas Tynkkynen
2017-04-10 01:41:49 +03:00
139 changed files with 2690 additions and 2092 deletions

View File

@@ -0,0 +1,65 @@
{stdenv, fetchurl, arm-frc-linux-gnueabi-linux-api-headers}:
let
_target = "arm-frc-linux-gnueabi";
_basever = "2.21-r0.83";
srcs = [
(fetchurl {
url = "http://download.ni.com/ni-linux-rt/feeds/2016/arm/ipk/cortexa9-vfpv3/libc6_${_basever}_cortexa9-vfpv3.ipk";
sha256 = "117058215440e258027bb9ff18db63c078d55288787dbedfcd5730c06c7a1ae9";
})
(fetchurl {
url = "http://download.ni.com/ni-linux-rt/feeds/2016/arm/ipk/cortexa9-vfpv3/libc6-dev_${_basever}_cortexa9-vfpv3.ipk";
sha256 = "e28b05d498c1160949f51539270035e12c5bb9d75d68df1f5f111a8fc087f3a6";
})
(fetchurl {
url = "http://download.ni.com/ni-linux-rt/feeds/2016/arm/ipk/cortexa9-vfpv3/libcidn1_${_basever}_cortexa9-vfpv3.ipk";
sha256 = "0f7372590abf69da54a9b7db8f944cf6c48d9ac8a091218ee60f84fdd9de2398";
})
(fetchurl {
url = "http://download.ni.com/ni-linux-rt/feeds/2016/arm/ipk/cortexa9-vfpv3/libc6-thread-db_${_basever}_cortexa9-vfpv3.ipk";
sha256 = "5a839498507a0b63165cb7a78234d7eb2ee2bb6a046bff586090f2e70e0e2bfb";
})
(fetchurl {
url = "http://download.ni.com/ni-linux-rt/feeds/2016/arm/ipk/cortexa9-vfpv3/libc6-extra-nss_${_basever}_cortexa9-vfpv3.ipk";
sha256 = "d765d43c8ec95a4c64fa38eddf8cee848fd090d9cc5b9fcda6d2c9b03d2635c5";
})
];
in
stdenv.mkDerivation rec {
version = "2.21";
name = "${_target}-eglibc-${version}";
sourceRoot = ".";
inherit srcs;
phases = [ "unpackPhase" "installPhase" ];
unpackCmd = ''
ar x $curSrc
tar xf data.tar.gz
'';
installPhase = ''
mkdir -p $out/${_target}
rm -rf lib/eglibc
find . \( -name .install -o -name ..install.cmd \) -delete
cp -r lib $out/${_target}
cp -r usr $out/${_target}
cp -r ${arm-frc-linux-gnueabi-linux-api-headers}/* $out
'';
meta = {
description = "FRC standard C lib";
longDescription = ''
eglibc library for the NI RoboRio to be used in compiling frc user
programs.
'';
license = stdenv.lib.licenses.gpl2;
maintainers = [ stdenv.lib.maintainers.colescott ];
platforms = stdenv.lib.platforms.linux;
priority = 2;
};
}

View File

@@ -0,0 +1,43 @@
{stdenv, fetchurl}:
let
_target = "arm-frc-linux-gnueabi";
_basever = "3.19-r0.36";
src = fetchurl {
url = "http://download.ni.com/ni-linux-rt/feeds/2016/arm/ipk/cortexa9-vfpv3/linux-libc-headers-dev_${_basever}_cortexa9-vfpv3.ipk";
sha256 = "10066ddb9a19bf764a9a67919a7976478041e98c44c19308f076c78ecb07408c";
};
in
stdenv.mkDerivation rec {
version = "3.19";
name = "${_target}-linux-api-headers-${version}";
sourceRoot = ".";
inherit src;
phases = [ "unpackPhase" "installPhase" ];
unpackCmd = ''
ar x $curSrc
tar xf data.tar.gz
'';
installPhase = ''
mkdir -p $out/${_target}
find . \( -name .install -o -name ..install.cmd \) -delete
cp -r usr/ $out/${_target}
'';
meta = {
description = "FRC linux api headers";
longDescription = ''
All linux api headers required to compile the arm-frc-linux-gnuaebi-gcc
cross compiler and all user programs.
'';
license = stdenv.lib.licenses.gpl2;
maintainers = [ stdenv.lib.maintainers.colescott ];
platforms = stdenv.lib.platforms.linux;
priority = 1;
};
}

View File

@@ -110,7 +110,7 @@
#, libquvi ? null # Quvi input support
, samba ? null # Samba protocol
#, schroedinger ? null # Dirac de/encoder
, SDL ? null
, SDL2 ? null
#, shine ? null # Fixed-point MP3 encoder
, soxr ? null # Resampling via soxr
, speex ? null # Speex de/encoder
@@ -199,7 +199,7 @@ assert ffplayProgram -> avcodecLibrary
&& avformatLibrary
&& swscaleLibrary
&& swresampleLibrary
&& SDL != null;
&& SDL2 != null;
assert ffprobeProgram -> avcodecLibrary && avformatLibrary;
assert ffserverProgram -> avformatLibrary;
/*
@@ -368,7 +368,7 @@ stdenv.mkDerivation rec {
#(enableFeature (schroedinger != null) "libschroedinger")
#(enableFeature (shine != null) "libshine")
(enableFeature (samba != null && gplLicensing && version3Licensing) "libsmbclient")
(enableFeature (SDL != null) "sdl") # Only configurable since 2.5, auto detected before then
(enableFeature (SDL2 != null) "sdl2")
(enableFeature (soxr != null) "libsoxr")
(enableFeature (speex != null) "libspeex")
#(enableFeature (twolame != null) "libtwolame")
@@ -401,7 +401,7 @@ stdenv.mkDerivation rec {
libjack2 ladspaH lame libass libbluray libbs2b libcaca libdc1394 libmodplug
libogg libopus libssh libtheora libvdpau libvorbis libvpx libwebp libX11
libxcb libXext libXfixes libXv lzma openal openjpeg_1 libpulseaudio rtmpdump
samba SDL soxr speex vid-stab wavpack x264 x265 xavs xvidcore zeromq4 zlib
samba SDL2 soxr speex vid-stab wavpack x264 x265 xavs xvidcore zeromq4 zlib
] ++ optional openglExtlib mesa
++ optionals x11grabExtlib [ libXext libXfixes ]
++ optionals nonfreeLicensing [ fdk_aac openssl ]

View File

@@ -1,5 +1,6 @@
{ stdenv, fetchFromGitHub, cmake, mesa, libXrandr, libXi, libXxf86vm, libXfixes, xlibsWrapper
, libXinerama, libXcursor
, darwin
}:
stdenv.mkDerivation rec {
@@ -18,7 +19,7 @@ stdenv.mkDerivation rec {
buildInputs = [
cmake mesa libXrandr libXi libXxf86vm libXfixes xlibsWrapper
libXinerama libXcursor
];
] ++ stdenv.lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ Cocoa Kernel ]);
cmakeFlags = "-DBUILD_SHARED_LIBS=ON";

View File

@@ -1,4 +1,5 @@
{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, udev, libusb }:
{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, udev, libusb
, darwin }:
stdenv.mkDerivation rec {
name = "hidapi-0.8.0-rc1";
@@ -10,7 +11,10 @@ stdenv.mkDerivation rec {
sha256 = "13d5jkmh9nh4c2kjch8k8amslnxapa9vkqzrk1z6rqmw8qgvzbkj";
};
buildInputs = [ autoreconfHook pkgconfig udev libusb ];
buildInputs = [ autoreconfHook pkgconfig ]
++ stdenv.lib.optionals stdenv.isLinux [ udev libusb ];
propagatedBuildInputs = stdenv.lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ IOKit Cocoa ]);
meta = with stdenv.lib; {
homepage = https://github.com/signal11/hidapi;

View File

@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
sed -i 's|/usr/|/|g' Makefile
'';
makeFlags = "shared";
makeFlags = [ "shared" ];
installPhase = ''
make install DESTDIR=$out/ LIBDIR=lib
@@ -28,6 +28,6 @@ stdenv.mkDerivation rec {
license = licenses.bsd2;
homepage = https://github.com/wfeldt/libx86emu;
maintainers = with maintainers; [ bobvanderlinden ];
platforms = platforms.unix;
platforms = platforms.linux;
};
}

View File

@@ -187,7 +187,7 @@ stdenv.mkDerivation {
# set the default search path for DRI drivers; used e.g. by X server
substituteInPlace "$dev/lib/pkgconfig/dri.pc" --replace '$(drivers)' "${driverLink}"
'' + optionalString (builtins.elem "intel" vulkanDrivers) ''
'' + optionalString (vulkanDrivers != []) ''
# move share/vulkan/icd.d/
mv $out/share/ $drivers/
# Update search path used by Vulkan (it's pointing to $out but

View File

@@ -25,6 +25,6 @@ stdenv.mkDerivation rec {
license = licenses.lgpl2;
homepage = https://01.org/linux-nfc;
maintainers = with maintainers; [ tstrobel ];
platforms = platforms.unix;
platforms = platforms.linux;
};
}

View File

@@ -76,6 +76,7 @@ let
qtgraphicaleffects = callPackage ./qtgraphicaleffects.nix {};
qtimageformats = callPackage ./qtimageformats.nix {};
qtlocation = callPackage ./qtlocation.nix {};
qtmacextras = callPackage ./qtmacextras.nix {};
qtmultimedia = callPackage ./qtmultimedia.nix {
inherit gstreamer gst-plugins-base;
};
@@ -97,12 +98,13 @@ let
qtxmlpatterns = callPackage ./qtxmlpatterns.nix {};
env = callPackage ../qt-env.nix {};
full = env "qt-${qtbase.version}" [
full = env "qt-${qtbase.version}" ([
qtconnectivity qtdeclarative qtdoc qtgraphicaleffects
qtimageformats qtlocation qtmultimedia qtquickcontrols qtscript
qtsensors qtserialport qtsvg qttools qttranslations qtwayland
qtsensors qtserialport qtsvg qttools qttranslations
qtwebsockets qtx11extras qtxmlpatterns
];
] ++ optional (!stdenv.isDarwin) qtwayland
++ optional (stdenv.isDarwin) qtmacextras);
makeQtWrapper =
makeSetupHook

View File

@@ -211,8 +211,10 @@ stdenv.mkDerivation {
libX11 libXcomposite libXext libXi libXrender libxcb libxkbcommon xcbutil
xcbutilimage xcbutilkeysyms xcbutilrenderutil xcbutilwm
] ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
ApplicationServices Foundation CoreServices AppKit Carbon OpenGL AGL Cocoa
DiskArbitration darwin.cf-private libiconv
AGL AppKit ApplicationServices Carbon Cocoa
CoreAudio CoreBluetooth CoreLocation CoreServices
DiskArbitration Foundation OpenGL
darwin.cf-private darwin.apple_sdk.sdk darwin.libobjc libiconv
]);
buildInputs = [ ]

View File

@@ -1,8 +1,18 @@
{ qtSubmodule, lib, copyPathsToStore, python2, qtbase, qtsvg, qtxmlpatterns }:
{ stdenv, qtSubmodule, makeQtWrapper, copyPathsToStore, python2, qtbase, qtsvg, qtxmlpatterns }:
with stdenv.lib;
qtSubmodule {
name = "qtdeclarative";
patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
patches = copyPathsToStore (readPathsFromFile ./. ./series);
qtInputs = [ qtbase qtsvg qtxmlpatterns ];
nativeBuildInputs = [ python2 ];
nativeBuildInputs = [ python2 makeQtWrapper ];
postInstall = ''
wrapQtProgram $out/bin/qmleasing
wrapQtProgram $out/bin/qmlscene
wrapQtProgram $out/bin/qmltestrunner
'' + optionalString (stdenv.isDarwin) ''
wrapQtProgram $out/bin/qml.app/Contents/MacOS/qml
'';
}

View File

@@ -0,0 +1,10 @@
{ qtSubmodule, qtbase, lib }:
qtSubmodule {
name = "qtmacextras";
qtInputs = [ qtbase ];
meta = with lib; {
maintainers = with maintainers; [ periklis ];
platforms = platforms.darwin;
};
}

View File

@@ -1,12 +1,15 @@
{ qtSubmodule, qtbase, qtdeclarative, pkgconfig
{ stdenv, qtSubmodule, qtbase, qtdeclarative, pkgconfig
, alsaLib, gstreamer, gst-plugins-base, libpulseaudio
, darwin
}:
with stdenv.lib;
qtSubmodule {
name = "qtmultimedia";
qtInputs = [ qtbase qtdeclarative ];
buildInputs = [
pkgconfig alsaLib gstreamer gst-plugins-base libpulseaudio
];
buildInputs = [ pkgconfig gstreamer gst-plugins-base libpulseaudio]
++ optional (stdenv.isLinux) alsaLib;
qmakeFlags = [ "GST_VERSION=1.0" ];
NIX_LDFLAGS = optionalString (stdenv.isDarwin) "-lobjc";
}

View File

@@ -1,4 +1,6 @@
{ qtSubmodule, qtbase, qtdeclarative }:
{ stdenv, qtSubmodule, qtbase, qtdeclarative }:
with stdenv.lib;
qtSubmodule {
name = "qtsensors";

View File

@@ -1,9 +1,11 @@
{ qtSubmodule, qtbase, substituteAll, systemd }:
{ stdenv, qtSubmodule, qtbase, substituteAll, systemd }:
with stdenv.lib;
qtSubmodule {
name = "qtserialport";
qtInputs = [ qtbase ];
patches = [
patches = optionals (stdenv.isLinux) [
(substituteAll {
src = ./0001-dlopen-serialport-udev.patch;
libudev = systemd.lib;

View File

@@ -1,11 +1,28 @@
{ qtSubmodule, lib, copyPathsToStore, qtbase }:
{ stdenv, qtSubmodule, makeQtWrapper, copyPathsToStore, qtbase }:
with stdenv.lib;
qtSubmodule {
name = "qttools";
qtInputs = [ qtbase ];
patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
nativeBuildInputs = [ makeQtWrapper ];
patches = copyPathsToStore (readPathsFromFile ./. ./series);
postFixup = ''
moveToOutput "bin/qdbus" "$out"
moveToOutput "bin/qtpaths" "$out"
'';
postInstall = ''
wrapQtProgram $out/bin/qcollectiongenerator
wrapQtProgram $out/bin/qhelpconverter
wrapQtProgram $out/bin/qhelpgenerator
wrapQtProgram $out/bin/qtdiag
'' + optionalString (stdenv.isDarwin) ''
wrapQtProgram $out/bin/Assistant.app/Contents/MacOS/Assistant
wrapQtProgram $out/bin/Designer.app/Contents/MacOS/Designer
wrapQtProgram $out/bin/Linguist.app/Contents/MacOS/Linguist
wrapQtProgram $out/bin/pixeltool.app/Contents/MacOS/pixeltool
wrapQtProgram $out/bin/qdbusviewer.app/Contents/MacOS/qdbusviewer
'';
}

View File

@@ -17,6 +17,8 @@
, lib, stdenv # lib.optional, needsPax
}:
with stdenv.lib;
qtSubmodule {
name = "qtwebengine";
qtInputs = [ qtquickcontrols qtlocation qtwebchannel ];
@@ -41,7 +43,7 @@ qtSubmodule {
-e "s,QLibraryInfo::location(QLibraryInfo::TranslationsPath),QLatin1String(\"$out/translations\"),g" \
-e "s,QLibraryInfo::location(QLibraryInfo::LibraryExecutablesPath),QLatin1String(\"$out/libexec\"),g" \
src/core/web_engine_library_info.cpp
'' + optionalString (!stdenv.isDarwin) ''
sed -i -e '/lib_loader.*Load/s!"\(libudev\.so\)!"${systemd.lib}/lib/\1!' \
src/3rdparty/chromium/device/udev_linux/udev?_loader.cc
@@ -49,11 +51,9 @@ qtSubmodule {
src/3rdparty/chromium/gpu/config/gpu_info_collector_linux.cc
'';
qmakeFlags = lib.optional enableProprietaryCodecs "WEBENGINE_CONFIG+=use_proprietary_codecs";
qmakeFlags = optional enableProprietaryCodecs "WEBENGINE_CONFIG+=use_proprietary_codecs";
propagatedBuildInputs = [
dbus zlib minizip alsaLib snappy nss protobuf jsoncpp libevent
# Image formats
libjpeg libpng libtiff libwebp
@@ -61,19 +61,28 @@ qtSubmodule {
srtp libvpx
# Audio formats
alsaLib libopus
libopus
# Text rendering
fontconfig freetype harfbuzz icu
harfbuzz icu
]
++ optionals (!stdenv.isDarwin) [
dbus zlib minizip snappy nss protobuf jsoncpp libevent
# Audio formats
alsaLib
# Text rendering
fontconfig freetype
libcap
pciutils
# X11 libs
xlibs.xrandr libXScrnSaver libXcursor libXrandr xlibs.libpciaccess libXtst
xlibs.libXcomposite
libcap
pciutils
];
patches = lib.optional stdenv.needsPax ./qtwebengine-paxmark-mksnapshot.patch;
patches = optional stdenv.needsPax ./qtwebengine-paxmark-mksnapshot.patch;
postInstall = ''
cat > $out/libexec/qt.conf <<EOF
[Paths]

View File

@@ -0,0 +1,11 @@
--- qtwebkit-opensource-src-5.8.0.orig/Source/WTF/WTF.pri
+++ qtwebkit-opensource-src-5.8.0/Source/WTF/WTF.pri
@@ -12,7 +12,7 @@
# Mac OS does ship libicu but not the associated header files.
# Therefore WebKit provides adequate header files.
INCLUDEPATH = $${ROOT_WEBKIT_DIR}/Source/WTF/icu $$INCLUDEPATH
- LIBS += -licucore
+ LIBS += /usr/lib/libicucore.dylib
} else:!use?(wchar_unicode): {
win32 {
CONFIG(static, static|shared) {

View File

@@ -2,6 +2,7 @@
, fontconfig, gdk_pixbuf, gtk2, libwebp, libxml2, libxslt
, sqlite, systemd, glib, gst_all_1
, bison2, flex, gdb, gperf, perl, pkgconfig, python2, ruby
, darwin
, substituteAll
, flashplayerFix ? false
}:
@@ -11,10 +12,16 @@ with stdenv.lib;
qtSubmodule {
name = "qtwebkit";
qtInputs = [ qtdeclarative qtlocation qtsensors ];
buildInputs = [ fontconfig libwebp libxml2 libxslt sqlite glib gst_all_1.gstreamer gst_all_1.gst-plugins-base ];
buildInputs = [ fontconfig libwebp libxml2 libxslt sqlite glib gst_all_1.gstreamer gst_all_1.gst-plugins-base ]
++ optionals (stdenv.isDarwin) (with darwin.apple_sdk.frameworks; [ OpenGL ]);
nativeBuildInputs = [
bison2 flex gdb gperf perl pkgconfig python2 ruby
];
__impureHostDeps = optionals (stdenv.isDarwin) [
"/usr/lib/libicucore.dylib"
];
patches =
let dlopen-webkit-nsplugin = substituteAll {
src = ./0001-dlopen-webkit-nsplugin.patch;
@@ -30,6 +37,7 @@ qtSubmodule {
libudev = systemd.lib;
};
in optionals flashplayerFix [ dlopen-webkit-nsplugin dlopen-webkit-gtk ]
++ [ dlopen-webkit-udev ];
meta.maintainers = with stdenv.lib.maintainers; [ abbradar ];
++ optionals (!stdenv.isDarwin) [ dlopen-webkit-udev ]
++ optionals (stdenv.isDarwin) [ ./0004-icucore-darwin.patch ];
meta.maintainers = with stdenv.lib.maintainers; [ abbradar periklis ];
}

View File

@@ -40,9 +40,9 @@ stdenv.mkDerivation {
-e 's|^[[:space:]]*\(CUDART_LIB =\)|CUDART_LIB = $(CUDA_ROOT)/lib64/libcudart.so|' \
-e 's|^[[:space:]]*\(CUBLAS_LIB =\)|CUBLAS_LIB = $(CUDA_ROOT)/lib64/libcublas.so|' \
-e 's|^[[:space:]]*\(CUDA_INC_PATH =\)|CUDA_INC_PATH = $(CUDA_ROOT)/include/|' \
-e 's|^[[:space:]]*\(NV_20 =\)|NV_20 = -arch=sm_20 -Xcompiler -fPIC|' \
-e 's|^[[:space:]]*\(NV_30 =\)|NV_30 = -arch=sm_30 -Xcompiler -fPIC|' \
-e 's|^[[:space:]]*\(NV_35 =\)|NV_35 = -arch=sm_35 -Xcompiler -fPIC|' \
-e 's|^[[:space:]]*\(NV20 =\)|NV20 = -arch=sm_20 -Xcompiler -fPIC|' \
-e 's|^[[:space:]]*\(NV30 =\)|NV30 = -arch=sm_30 -Xcompiler -fPIC|' \
-e 's|^[[:space:]]*\(NV35 =\)|NV35 = -arch=sm_35 -Xcompiler -fPIC|' \
-e 's|^[[:space:]]*\(NVCC =\) echo|NVCC = $(CUDA_ROOT)/bin/nvcc|' \
-e 's|^[[:space:]]*\(NVCCFLAGS =\)|NVCCFLAGS = $(NV20) -O3 -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_60,code=sm_60|'
'';
@@ -64,7 +64,7 @@ stdenv.mkDerivation {
for i in "$out"/lib/lib*.a; do
ar -x $i
done
''${CC} *.o ${if stdenv.isDarwin then "-dynamiclib" else "--shared"} -o "$out/lib/libsuitesparse.${SHLIB_EXT}" -lopenblas
${if enableCuda then cudatoolkit else stdenv.cc.outPath}/bin/${if enableCuda then "nvcc" else "cc"} *.o ${if stdenv.isDarwin then "-dynamiclib" else "--shared"} -o "$out/lib/libsuitesparse.${SHLIB_EXT}" -lopenblas ${stdenv.lib.optionalString enableCuda "-lcublas"}
)
for i in umfpack cholmod amd camd colamd spqr; do
ln -s libsuitesparse.${SHLIB_EXT} "$out"/lib/lib$i.${SHLIB_EXT}

View File

@@ -3,12 +3,12 @@
libXext, wayland, mesa_noglu }:
let
version = "1.0.39.1";
version = "1.0.42.2";
src = fetchFromGitHub {
owner = "KhronosGroup";
repo = "Vulkan-LoaderAndValidationLayers";
rev = "sdk-${version}";
sha256 = "0y9zzrnjjjza2kkf5jfsdqhn98md6rsq0hb7jg62z2dipzky7zdp";
sha256 = "0na1ax2cgv6w29213mby56mndfsj3iizj3n5pbpy4s4p7ij9kdgn";
};
in
@@ -26,8 +26,6 @@ stdenv.mkDerivation rec {
"-DFALLBACK_DATA_DIRS=${mesa_noglu.driverLink}/share:/usr/local/share:/usr/share"
];
patches = [ ./use-xdg-paths.patch ./fallback-paths.patch ];
outputs = [ "out" "dev" "demos" ];
preConfigure = ''
@@ -59,5 +57,6 @@ stdenv.mkDerivation rec {
homepage = "http://www.lunarg.com";
platforms = platforms.linux;
license = licenses.asl20;
maintainers = [ maintainers.ralith ];
};
}

View File

@@ -1,52 +0,0 @@
commit a59b141559a8c1813da438b97e5f79eeb6cc7642
Author: Benjamin Saunders <ben.e.saunders@gmail.com>
Date: Sun Feb 19 11:14:24 2017 -0800
loader: Configurable fallback search paths
This makes it easier for non-FHS distributions to behave well when the loader
is used by a SUID process or in an otherwise unusual environment.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a43d264..d28b3f5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,6 +16,11 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
find_package(PythonInterp 3 REQUIRED)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ set(FALLBACK_CONFIG_DIRS "/etc/xdg" CACHE STRING
+ "Search path to use when XDG_CONFIG_DIRS is unset or empty or the current process is SUID/SGID. Default is freedesktop compliant.")
+ set(FALLBACK_DATA_DIRS "/usr/local/share:/usr/share" CACHE STRING
+ "Search path to use when XDG_DATA_DIRS is unset or empty or the current process is SUID/SGID. Default is freedesktop compliant.")
+
include(FindPkgConfig)
option(BUILD_WSI_XCB_SUPPORT "Build XCB WSI support" ON)
option(BUILD_WSI_XLIB_SUPPORT "Build Xlib WSI support" ON)
@@ -285,7 +290,10 @@ run_vk_xml_generate(dispatch_table_generator.py vk_dispatch_table_helper.h)
if(NOT WIN32)
include(GNUInstallDirs)
+ add_definitions(-DFALLBACK_CONFIG_DIRS="${FALLBACK_CONFIG_DIRS}")
+ add_definitions(-DFALLBACK_DATA_DIRS="${FALLBACK_DATA_DIRS}")
add_definitions(-DSYSCONFDIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}")
+
# Make sure /etc is searched by the loader
if(NOT (CMAKE_INSTALL_FULL_SYSCONFDIR STREQUAL "/etc"))
add_definitions(-DEXTRASYSCONFDIR="/etc")
diff --git a/loader/loader.c b/loader/loader.c
index 81c37c4..83378eb 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -2644,9 +2644,9 @@ static VkResult loader_get_manifest_files(const struct loader_instance *inst, co
const char *xdgconfdirs = secure_getenv("XDG_CONFIG_DIRS");
const char *xdgdatadirs = secure_getenv("XDG_DATA_DIRS");
if (xdgconfdirs == NULL || xdgconfdirs[0] == '\0')
- xdgconfdirs = "/etc/xdg";
+ xdgconfdirs = FALLBACK_CONFIG_DIRS;
if (xdgdatadirs == NULL || xdgdatadirs[0] == '\0')
- xdgdatadirs = "/usr/local/share:/usr/share";
+ xdgdatadirs = FALLBACK_DATA_DIRS;
const size_t rel_size = strlen(relative_location);
// Leave space for trailing separators
loc_size += strlen(xdgconfdirs) + strlen(xdgdatadirs) + 2*rel_size + 2;

View File

@@ -1,322 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 27ab6e5..e59256e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -256,17 +256,10 @@ if(NOT WIN32)
include(GNUInstallDirs)
add_definitions(-DSYSCONFDIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}")
- add_definitions(-DDATADIR="${CMAKE_INSTALL_FULL_DATADIR}")
-
# Make sure /etc is searched by the loader
- if (NOT (CMAKE_INSTALL_FULL_SYSCONFDIR STREQUAL "/etc"))
+ if(NOT (CMAKE_INSTALL_FULL_SYSCONFDIR STREQUAL "/etc"))
add_definitions(-DEXTRASYSCONFDIR="/etc")
endif()
-
- # Make sure /usr/share is searched by the loader
- if (NOT (CMAKE_INSTALL_FULL_DATADIR STREQUAL "/usr/share"))
- add_definitions(-DEXTRADATADIR="/usr/share")
- endif()
endif()
if(UNIX)
diff --git a/loader/loader.c b/loader/loader.c
index 24758f4..af7cc85 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -2909,7 +2909,7 @@ static VkResult
loader_get_manifest_files(const struct loader_instance *inst,
const char *env_override, const char *source_override,
bool is_layer, bool warn_if_not_present,
- const char *location, const char *home_location,
+ const char *location, const char *relative_location,
struct loader_manifest_files *out_files) {
const char * override = NULL;
char *override_getenv = NULL;
@@ -2941,9 +2941,9 @@ loader_get_manifest_files(const struct loader_instance *inst,
}
#if !defined(_WIN32)
- if (location == NULL && home_location == NULL) {
+ if (location == NULL && relative_location == NULL) {
#else
- home_location = NULL;
+ relative_location = NULL;
if (location == NULL) {
#endif
loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
@@ -2962,16 +2962,89 @@ loader_get_manifest_files(const struct loader_instance *inst,
// Make a copy of the input we are using so it is not modified
// Also handle getting the location(s) from registry on Windows
if (override == NULL) {
- loc = loader_stack_alloc(strlen(location) + 1);
+ size_t loc_size = strlen(location) + 1;
+#if !defined(_WIN32)
+ const char *xdgconfdirs = secure_getenv("XDG_CONFIG_DIRS");
+ const char *xdgdatadirs = secure_getenv("XDG_DATA_DIRS");
+ if (xdgconfdirs == NULL || xdgconfdirs[0] == '\0')
+ xdgconfdirs = "/etc/xdg";
+ if (xdgdatadirs == NULL || xdgdatadirs[0] == '\0')
+ xdgdatadirs = "/usr/local/share:/usr/share";
+ const size_t rel_size = strlen(relative_location);
+ // Leave space for trailing separators
+ loc_size += strlen(xdgconfdirs) + strlen(xdgdatadirs) + 2*rel_size + 2;
+ for (const char *x = xdgconfdirs; *x; ++x)
+ if (*x == PATH_SEPARATOR) loc_size += rel_size;
+ for (const char *x = xdgdatadirs; *x; ++x)
+ if (*x == PATH_SEPARATOR) loc_size += rel_size;
+ loc_size += strlen(SYSCONFDIR) + rel_size + 1;
+#ifdef EXTRASYSCONFDIR
+ loc_size += strlen(EXTRASYSCONFDIR) + rel_size + 1;
+#endif
+#endif
+ loc = loader_stack_alloc(loc_size);
if (loc == NULL) {
loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
"loader_get_manifest_files: Failed to allocate "
"%d bytes for manifest file location.",
- strlen(location));
+ loc_size);
res = VK_ERROR_OUT_OF_HOST_MEMORY;
goto out;
}
- strcpy(loc, location);
+ char *loc_write = loc;
+#if !defined(_WIN32)
+ const char *loc_read;
+
+ loc_read = &xdgconfdirs[0];
+ for (const char *x = loc_read;; ++x) {
+ if (*x == PATH_SEPARATOR || *x == '\0') {
+ const size_t s = x - loc_read;
+ memcpy(loc_write, loc_read, s);
+ loc_write += s;
+ memcpy(loc_write, relative_location, rel_size);
+ loc_write += rel_size;
+ *loc_write++ = PATH_SEPARATOR;
+ if (*x == 0)
+ break;
+ loc_read = ++x;
+ }
+ }
+
+ memcpy(loc_write, SYSCONFDIR, strlen(SYSCONFDIR));
+ loc_write += strlen(SYSCONFDIR);
+ memcpy(loc_write, relative_location, rel_size);
+ loc_write += rel_size;
+ *loc_write++ = PATH_SEPARATOR;
+
+#ifdef EXTRASYSCONFDIR
+ memcpy(loc_write, EXTRASYSCONFDIR, strlen(EXTRASYSCONFDIR));
+ loc_write += strlen(EXTRASYSCONFDIR);
+ memcpy(loc_write, relative_location, rel_size);
+ loc_write += rel_size;
+ *loc_write++ = PATH_SEPARATOR;
+#endif
+
+ loc_read = &xdgdatadirs[0];
+ for (const char *x = loc_read;; ++x) {
+ if (*x == PATH_SEPARATOR || *x == '\0') {
+ const size_t s = x - loc_read;
+ memcpy(loc_write, loc_read, s);
+ loc_write += s;
+ memcpy(loc_write, relative_location, rel_size);
+ loc_write += rel_size;
+ *loc_write++ = PATH_SEPARATOR;
+ if (*x == 0)
+ break;
+ loc_read = ++x;
+ }
+ }
+ --loc_write;
+ *loc_write = '\0';
+#else
+ memcpy(loc_write, location, loc_size);
+ loc[loc_size-1] = '\0';
+#endif
+
#if defined(_WIN32)
VkResult reg_result = loaderGetRegistryFiles(inst, loc, &reg);
if (VK_SUCCESS != reg_result || NULL == reg) {
@@ -3122,14 +3195,14 @@ loader_get_manifest_files(const struct loader_instance *inst,
}
file = next_file;
#if !defined(_WIN32)
- if (home_location != NULL &&
+ if (relative_location != NULL &&
(next_file == NULL || *next_file == '\0') && override == NULL) {
char *xdgdatahome = secure_getenv("XDG_DATA_HOME");
size_t len;
if (xdgdatahome != NULL) {
char *home_loc = loader_stack_alloc(strlen(xdgdatahome) + 2 +
- strlen(home_location));
+ strlen(relative_location));
if (home_loc == NULL) {
loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
"loader_get_manifest_files: Failed to allocate "
@@ -3139,15 +3212,15 @@ loader_get_manifest_files(const struct loader_instance *inst,
}
strcpy(home_loc, xdgdatahome);
// Add directory separator if needed
- if (home_location[0] != DIRECTORY_SYMBOL) {
+ if (relative_location[0] != DIRECTORY_SYMBOL) {
len = strlen(home_loc);
home_loc[len] = DIRECTORY_SYMBOL;
home_loc[len + 1] = '\0';
}
- strcat(home_loc, home_location);
+ strcat(home_loc, relative_location);
file = home_loc;
next_file = loader_get_next_path(file);
- home_location = NULL;
+ relative_location = NULL;
loader_log(
inst, VK_DEBUG_REPORT_DEBUG_BIT_EXT, 0,
@@ -3160,7 +3233,7 @@ loader_get_manifest_files(const struct loader_instance *inst,
char *home = secure_getenv("HOME");
if (home != NULL) {
char *home_loc = loader_stack_alloc(strlen(home) + 16 +
- strlen(home_location));
+ strlen(relative_location));
if (home_loc == NULL) {
loader_log(
inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
@@ -3178,15 +3251,15 @@ loader_get_manifest_files(const struct loader_instance *inst,
}
strcat(home_loc, ".local/share");
- if (home_location[0] != DIRECTORY_SYMBOL) {
+ if (relative_location[0] != DIRECTORY_SYMBOL) {
len = strlen(home_loc);
home_loc[len] = DIRECTORY_SYMBOL;
home_loc[len + 1] = '\0';
}
- strcat(home_loc, home_location);
+ strcat(home_loc, relative_location);
file = home_loc;
next_file = loader_get_next_path(file);
- home_location = NULL;
+ relative_location = NULL;
loader_log(
inst, VK_DEBUG_REPORT_DEBUG_BIT_EXT, 0,
@@ -3263,7 +3336,7 @@ VkResult loader_icd_scan(const struct loader_instance *inst,
// Get a list of manifest files for ICDs
res = loader_get_manifest_files(inst, "VK_ICD_FILENAMES", NULL, false, true,
DEFAULT_VK_DRIVERS_INFO,
- HOME_VK_DRIVERS_INFO, &manifest_files);
+ RELATIVE_VK_DRIVERS_INFO, &manifest_files);
if (VK_SUCCESS != res || manifest_files.count == 0) {
goto out;
}
@@ -3490,7 +3563,7 @@ void loader_layer_scan(const struct loader_instance *inst,
if (VK_SUCCESS !=
loader_get_manifest_files(inst, LAYERS_PATH_ENV, LAYERS_SOURCE_PATH,
true, true, DEFAULT_VK_ELAYERS_INFO,
- HOME_VK_ELAYERS_INFO, &manifest_files[0])) {
+ RELATIVE_VK_ELAYERS_INFO, &manifest_files[0])) {
goto out;
}
@@ -3499,7 +3572,7 @@ void loader_layer_scan(const struct loader_instance *inst,
// overridden by LAYERS_PATH_ENV
if (VK_SUCCESS != loader_get_manifest_files(inst, NULL, NULL, true, false,
DEFAULT_VK_ILAYERS_INFO,
- HOME_VK_ILAYERS_INFO,
+ RELATIVE_VK_ILAYERS_INFO,
&manifest_files[1])) {
goto out;
}
@@ -3569,7 +3642,7 @@ void loader_implicit_layer_scan(const struct loader_instance *inst,
// overridden by LAYERS_PATH_ENV
VkResult res = loader_get_manifest_files(
inst, NULL, NULL, true, false, DEFAULT_VK_ILAYERS_INFO,
- HOME_VK_ILAYERS_INFO, &manifest_files);
+ RELATIVE_VK_ILAYERS_INFO, &manifest_files);
if (VK_SUCCESS != res || manifest_files.count == 0) {
return;
}
diff --git a/loader/vk_loader_platform.h b/loader/vk_loader_platform.h
index dc4ac10..50a7966 100644
--- a/loader/vk_loader_platform.h
+++ b/loader/vk_loader_platform.h
@@ -57,47 +57,9 @@
#define VULKAN_ILAYERCONF_DIR "implicit_layer.d"
#define VULKAN_LAYER_DIR "layer"
-#if defined(EXTRASYSCONFDIR)
-#define EXTRA_DRIVERS_SYSCONFDIR_INFO ":" \
- EXTRASYSCONFDIR VULKAN_DIR VULKAN_ICDCONF_DIR
-#define EXTRA_ELAYERS_SYSCONFDIR_INFO ":" \
- EXTRASYSCONFDIR VULKAN_DIR VULKAN_ELAYERCONF_DIR
-#define EXTRA_ILAYERS_SYSCONFDIR_INFO ":" \
- EXTRASYSCONFDIR VULKAN_DIR VULKAN_ILAYERCONF_DIR
-#else
-#define EXTRA_DRIVERS_SYSCONFDIR_INFO
-#define EXTRA_ELAYERS_SYSCONFDIR_INFO
-#define EXTRA_ILAYERS_SYSCONFDIR_INFO
-#endif
-
-#if defined(EXTRADATADIR)
-#define EXTRA_DRIVERS_DATADIR_INFO ":" \
- EXTRADATADIR VULKAN_DIR VULKAN_ICDCONF_DIR
-#define EXTRA_ELAYERS_DATADIR_INFO ":" \
- EXTRADATADIR VULKAN_DIR VULKAN_ELAYERCONF_DIR
-#define EXTRA_ILAYERS_DATADIR_INFO ":" \
- EXTRADATADIR VULKAN_DIR VULKAN_ILAYERCONF_DIR
-#else
-#define EXTRA_DRIVERS_DATADIR_INFO
-#define EXTRA_ELAYERS_DATADIR_INFO
-#define EXTRA_ILAYERS_DATADIR_INFO
-#endif
-
-#define DEFAULT_VK_DRIVERS_INFO \
- SYSCONFDIR VULKAN_DIR VULKAN_ICDCONF_DIR ":" \
- DATADIR VULKAN_DIR VULKAN_ICDCONF_DIR \
- EXTRA_DRIVERS_SYSCONFDIR_INFO \
- EXTRA_DRIVERS_DATADIR_INFO
-#define DEFAULT_VK_ELAYERS_INFO \
- SYSCONFDIR VULKAN_DIR VULKAN_ELAYERCONF_DIR ":" \
- DATADIR VULKAN_DIR VULKAN_ELAYERCONF_DIR \
- EXTRA_ELAYERS_SYSCONFDIR_INFO \
- EXTRA_ELAYERS_DATADIR_INFO
-#define DEFAULT_VK_ILAYERS_INFO \
- SYSCONFDIR VULKAN_DIR VULKAN_ILAYERCONF_DIR ":" \
- DATADIR VULKAN_DIR VULKAN_ILAYERCONF_DIR \
- EXTRA_ILAYERS_SYSCONFDIR_INFO \
- EXTRA_ILAYERS_DATADIR_INFO
+#define DEFAULT_VK_DRIVERS_INFO ""
+#define DEFAULT_VK_ELAYERS_INFO ""
+#define DEFAULT_VK_ILAYERS_INFO ""
#define DEFAULT_VK_DRIVERS_PATH ""
#if !defined(DEFAULT_VK_LAYERS_PATH)
@@ -109,9 +71,9 @@
#endif
#define LAYERS_PATH_ENV "VK_LAYER_PATH"
-#define HOME_VK_DRIVERS_INFO VULKAN_DIR VULKAN_ICDCONF_DIR
-#define HOME_VK_ELAYERS_INFO VULKAN_DIR VULKAN_ELAYERCONF_DIR
-#define HOME_VK_ILAYERS_INFO VULKAN_DIR VULKAN_ILAYERCONF_DIR
+#define RELATIVE_VK_DRIVERS_INFO VULKAN_DIR VULKAN_ICDCONF_DIR
+#define RELATIVE_VK_ELAYERS_INFO VULKAN_DIR VULKAN_ELAYERCONF_DIR
+#define RELATIVE_VK_ILAYERS_INFO VULKAN_DIR VULKAN_ILAYERCONF_DIR
// C99:
#define PRINTF_SIZE_T_SPECIFIER "%zu"
@@ -251,9 +213,9 @@ loader_platform_thread_cond_broadcast(loader_platform_thread_cond *pCond) {
#define LAYERS_SOURCE_PATH NULL
#endif
#define LAYERS_PATH_ENV "VK_LAYER_PATH"
-#define HOME_VK_DRIVERS_INFO ""
-#define HOME_VK_ELAYERS_INFO ""
-#define HOME_VK_ILAYERS_INFO ""
+#define RELATIVE_VK_DRIVERS_INFO ""
+#define RELATIVE_VK_ELAYERS_INFO ""
+#define RELATIVE_VK_ILAYERS_INFO ""
#define PRINTF_SIZE_T_SPECIFIER "%Iu"
// File IO

View File

@@ -62,8 +62,8 @@ stdenv.mkDerivation rec {
};
enableParallelBuilding = true;
meta = {
platforms = stdenv.lib.platforms.all;
platforms = stdenv.lib.platforms.linux;
};
}

View File

@@ -20,7 +20,7 @@ stdenv.mkDerivation {
meta = {
homepage = http://linux.techass.com/projects/xdb/;
description = "C++ class library formerly known as XDB";
platforms = stdenv.lib.platforms.all;
platforms = stdenv.lib.platforms.linux;
maintainers = [ ];
};
}