summaryrefslogtreecommitdiff
path: root/env
diff options
context:
space:
mode:
Diffstat (limited to 'env')
-rw-r--r--env/build_cmds.txt50
-rw-r--r--env/msvc_build.sh6
-rw-r--r--env/nixpkgs-patches/539430.diff81
3 files changed, 108 insertions, 29 deletions
diff --git a/env/build_cmds.txt b/env/build_cmds.txt
index 06dab23..896ba55 100644
--- a/env/build_cmds.txt
+++ b/env/build_cmds.txt
@@ -1,39 +1,37 @@
# Testing
-meson setup build -Dserver=enabled -Dclient=enabled -Dportal=enabled -Dtests=enabled \
- --force-fallback-for=libplacebo
+meson setup build -Dfruits=cmsrv,cmc,cmv \
+ -Dportal=enabled -Dtests=enabled --force-fallback-for=libplacebo
# Android
-meson setup build-android -Dserver=disabled -Drenderer-api=gl -Dwindow=glfm \
- -Dcodec-ffmpeg-version=8 -Dcodec-hwaccels=mediacodec -Dtests=disabled \
- --cross-file ./cross/aarch64-linux-android.txt --default-library=static
+meson setup build-android -Dfruits=cmv \
+ -Dsources=file,http -Dcodec-hwaccels=mediacodec \
+ --cross-file ./cross/aarch64-linux-android.txt \
+ --default-library=static
# MingW DX11 (Preferred)
-meson setup build-mingw64-dx11 -Drenderer-api=dx11 -Drenderer=libplacebo -Dwindow=win32 \
- -Dsink-only=false -Dserver=enabled -Dportal=disabled -Dclient=disabled \
- -Dsources=file -Dcodecs=ffmpeg -Dcodec-ffmpeg-version=8 -Dcodec-hwaccels=d3d11va -Dsubtitles=enabled \
- -Dtests=disabled -Dwin32-compat=false --cross-file ./cross/x86_64-w64-mingw32.txt \
- --default-library=static --strip --buildtype=release -Ddebug=false --optimization=s -Db_lto=true
+meson setup build-mingw64-dx11 -Dfruits=cmv \
+ -Dcodecs=ffmpeg -Dcodec-hwaccels=d3d11va \
+ --cross-file ./cross/x86_64-w64-mingw32.txt \
+ --default-library=static --buildtype=release --optimization=s -Db_lto=true
# MingW Vulkan
-meson setup build-mingw64-vulkan -Drenderer-api=vulkan -Drenderer=libplacebo -Dwindow=win32 \
- -Dsink-only=false -Dserver=enabled -Dportal=disabled -Dclient=disabled \
- -Dsources=file -Dcodecs=ffmpeg,stb_image -Dcodec-ffmpeg-version=8 -Dcodec-hwaccels=vulkan -Dsubtitles=enabled \
- -Dtests=disabled -Dwin32-compat=false --cross-file ./cross/x86_64-w64-mingw32.txt \
- --default-library=static --strip --buildtype=release -Ddebug=false --optimization=2
+meson setup build-mingw64-vulkan -Dfruits=cmv \
+ -Drenderer-api=vulkan -Dcodecs=ffmpeg -Dcodec-hwaccels=vulkan \
+ --cross-file ./cross/x86_64-w64-mingw32.txt \
+ --default-library=static --buildtype=release --optimization=2
# Windows XP 32bit Support.
-meson setup build-mingw32-min -Drenderer-api=gl -Drenderer=momo -Dwindow=win32 \
- -Dsink-only=false -Dserver=enabled -Dportal=disabled -Dclient=disabled \
- -Dsources=file -Dcodecs=ffmpeg -Dcodec-ffmpeg-version=3 -Dsubtitles=enabled \
- -Dtests=disabled -Dwin32-compat=true --cross-file ./cross/i686-w64-mingw32.txt \
- --default-library=static --strip --buildtype=release -Ddebug=false --optimization=s -Db_lto=true
+meson setup build-mingw32-min -Dfruits=cmv \
+ -Drenderer-api=gl -Drenderer=momo -Dcodecs=ffmpeg -Dcodec-ffmpeg-version=3 \
+ -Dwin32-compat=true --cross-file ./cross/i686-w64-mingw32.txt \
+ --default-library=static --buildtype=release --optimization=s -Db_lto=true
# ASan
-meson setup build-asan --buildtype=debug -Db_sanitize=address -Db_lundef=false \
- -Dclient=enabled -Dportal=enabled -Dtests=enabled \
- -Dcodecs=ffmpeg,wuffs,stb_image --force-fallback-for=libplacebo
+meson setup build-asan -Dfruits=cmsrv,cmc,cmv \
+ -Dportal=enabled -Dtests=enabled --force-fallback-for=libplacebo \
+ --buildtype=debug -Db_sanitize=address -Db_lundef=false
# UBSan
-meson setup build-ubsan --buildtype=debug -Db_sanitize=undefined -Db_lundef=false \
- -Dclient=enabled -Dportal=enabled -Dtests=enabled \
- -Dcodecs=ffmpeg --force-fallback-for=libplacebo
+meson setup build-ubsan -Dfruits=cmsrv,cmc,cmv \
+ -Dportal=enabled -Dtests=enabled --force-fallback-for=libplacebo \
+ --buildtype=debug -Db_sanitize=undefined -Db_lundef=false
diff --git a/env/msvc_build.sh b/env/msvc_build.sh
index 13c4eca..bf077a9 100644
--- a/env/msvc_build.sh
+++ b/env/msvc_build.sh
@@ -3,10 +3,10 @@
# nix develop .#mingw64
# meson subprojects download msvc-wine
# cd subprojects/msvc-wine-514f8ea/
-# ./vsdownload.py --dest ../../env/msvc-root
-# ./install.sh ../../env/msvc-root
+# ./vsdownload.py --dest /opt/msvc-root
+# ./install.sh /opt/msvc-root
-BIN=env/msvc-root/bin/x64 . subprojects/msvc-wine-514f8ea/msvcenv-native.sh
+BIN=/opt/msvc-root/bin/x64 . subprojects/msvc-wine-514f8ea/msvcenv-native.sh
export INCLUDE="$INCLUDE:$HOME/c/camu/subprojects/vulkan-headers-1.4.325/include"
diff --git a/env/nixpkgs-patches/539430.diff b/env/nixpkgs-patches/539430.diff
new file mode 100644
index 0000000..9c4ec07
--- /dev/null
+++ b/env/nixpkgs-patches/539430.diff
@@ -0,0 +1,81 @@
+diff --git a/pkgs/development/compilers/llvm/common/compiler-rt/default.nix b/pkgs/development/compilers/llvm/common/compiler-rt/default.nix
+index 567462e3eba68..da799c93d08e0 100644
+--- a/pkgs/development/compilers/llvm/common/compiler-rt/default.nix
++++ b/pkgs/development/compilers/llvm/common/compiler-rt/default.nix
+@@ -36,7 +36,8 @@
+ # implementation of the routines instead of the implementation
+ # using ad-hoc mutexes (which doesn't depend on libc at all).
+ # Use of pthreads helps code play better with sanitizers.
+- withAtomicsPthread ? lib.versionAtLeast release_version "19" && stdenv.cc.libc != null,
++ withAtomicsPthread ?
++ lib.versionAtLeast release_version "19" && stdenv.cc.libc != null && !stdenv.hostPlatform.isMinGW,
+
+ # In recent releases, the compiler-rt build seems to produce
+ # many `libclang_rt*` libraries, but not a single unified
+@@ -214,7 +215,7 @@ stdenv.mkDerivation (finalAttrs: {
+ # Fixes https://github.com/NixOS/nixpkgs/issues/393603
+ (lib.cmakeBool "COMPILER_RT_DISABLE_AARCH64_FMV" true)
+ ++ lib.optionals withAtomics [
+- (lib.cmakeBool "COMPILER_RT_EXCLUDE_ATOMIC_BUILTIN" (!withAtomicsLib))
++ (lib.cmakeBool "COMPILER_RT_EXCLUDE_ATOMIC_BUILTIN" withAtomicsLib)
+ (lib.cmakeBool "COMPILER_RT_BUILD_STANDALONE_LIBATOMIC" withAtomicsLib)
+ (lib.cmakeBool "COMPILER_RT_LIBATOMIC_USE_PTHREAD" withAtomicsPthread)
+ ]
+@@ -291,11 +292,21 @@ stdenv.mkDerivation (finalAttrs: {
+ + lib.optionalString forceLinkCompilerRt ''
+ ln -s $out/lib/*/libclang_rt.builtins-*.a $out/lib/libcompiler_rt.a
+ ''
+- + lib.optionalString (withAtomics && withAtomicsLib) ''
+- ln -s $out/lib/*/libclang_rt.atomic-*.so $out/lib/libatomic.so
+- # create a link with the original soname as well, so it's found at runtime
+- ln -s $out/lib/*/libclang_rt.atomic-*.so $out/lib/
+- '';
++ + lib.optionalString (withAtomics && withAtomicsLib) (
++ let
++ isMinGW = stdenv.hostPlatform.isMinGW;
++ sharedLibrary = stdenv.hostPlatform.extensions.sharedLibrary;
++ linkLibrarySuffix = lib.optionalString isMinGW ".a";
++ runtimeDirectory = if isMinGW then "$out/bin" else "$out/lib";
++ atomicLibrary = "libclang_rt.atomic" + lib.optionalString isMinGW "_dynamic" + "-*${sharedLibrary}";
++ in
++ ''
++ mkdir -p ${runtimeDirectory}
++ ln -s $out/lib/*/${atomicLibrary}${linkLibrarySuffix} $out/lib/libatomic${sharedLibrary}${linkLibrarySuffix}
++ # Link the original runtime name where the loader searches for shared libraries.
++ ln -s $out/lib/*/${atomicLibrary} ${runtimeDirectory}/
++ ''
++ );
+
+ meta = llvm_meta // {
+ homepage = "https://compiler-rt.llvm.org/";
+diff --git a/pkgs/development/compilers/llvm/common/default.nix b/pkgs/development/compilers/llvm/common/default.nix
+index af2e39dced099..9afc972ce7c31 100644
+--- a/pkgs/development/compilers/llvm/common/default.nix
++++ b/pkgs/development/compilers/llvm/common/default.nix
+@@ -308,9 +308,11 @@ makeScopeWithSplicing' {
+ && stdenv.targetPlatform.useLLVM or false
+ ) "-lunwind"
+ ++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions";
+- nixSupport.cc-ldflags = lib.optionals (
+- !stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD
+- ) [ "-L${targetLlvmPackages.libunwind}/lib" ];
++ nixSupport.cc-ldflags =
++ lib.optionals (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD) [
++ "-L${targetLlvmPackages.libunwind}/lib"
++ ]
++ ++ lib.optional stdenv.targetPlatform.isMinGW "-L${targetLlvmPackages.compiler-rt}/lib";
+ };
+
+ clangWithLibcAndBasicRtAndLibcxx = wrapCCWith rec {
+@@ -424,6 +426,11 @@ makeScopeWithSplicing' {
+
+ compiler-rt-no-libc = callPackage ./compiler-rt {
+ doFakeLibgcc = stdenv.hostPlatform.useLLVM or false;
++ # This runtime is used to bootstrap the libc-capable toolchain. Keep
++ # atomics in builtins.a until that toolchain can link the shared atomic
++ # runtime against libc (and pthreads, when enabled).
++ withAtomicsLib = false;
++ withAtomicsPthread = false;
+ stdenv =
+ # Darwin needs to use a bootstrap stdenv to avoid an infinite recursion when cross-compiling.
+ if stdenv.hostPlatform.isDarwin then