summary refs log tree commit diff
path: root/pkgs/development/tools/build-managers/meson
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-11-21 16:12:21 +0100
committerAlyssa Ross <hi@alyssa.is>2023-11-21 16:12:48 +0100
commit048a4cd441a59cbf89defb18bb45c9f0b4429b35 (patch)
treef8f5850ff05521ab82d65745894714a8796cbfb6 /pkgs/development/tools/build-managers/meson
parent030c5028b07afcedce7c5956015c629486cc79d9 (diff)
parent4c2d05dd6435d449a3651a6dd314d9411b5f8146 (diff)
downloadnixpkgs-rootfs.tar
nixpkgs-rootfs.tar.gz
nixpkgs-rootfs.tar.bz2
nixpkgs-rootfs.tar.lz
nixpkgs-rootfs.tar.xz
nixpkgs-rootfs.tar.zst
nixpkgs-rootfs.zip
Rebase onto e4ad989506ec7d71f7302cc3067abd82730a4beb HEAD rootfs
Signed-off-by: Alyssa Ross <hi@alyssa.is>
Diffstat (limited to 'pkgs/development/tools/build-managers/meson')
-rw-r--r--pkgs/development/tools/build-managers/meson/boost-Do-not-add-system-paths-on-nix.patch21
-rw-r--r--pkgs/development/tools/build-managers/meson/clear-old-rpath.patch20
-rw-r--r--pkgs/development/tools/build-managers/meson/default.nix173
-rw-r--r--pkgs/development/tools/build-managers/meson/disable-bitcode.patch24
-rw-r--r--pkgs/development/tools/build-managers/meson/emulator-hook.sh5
-rw-r--r--pkgs/development/tools/build-managers/meson/fix-rpath.patch24
-rw-r--r--pkgs/development/tools/build-managers/meson/gir-fallback-path.patch21
-rw-r--r--pkgs/development/tools/build-managers/meson/more-env-vars.patch12
-rw-r--r--pkgs/development/tools/build-managers/meson/setup-hook.sh42
9 files changed, 0 insertions, 342 deletions
diff --git a/pkgs/development/tools/build-managers/meson/boost-Do-not-add-system-paths-on-nix.patch b/pkgs/development/tools/build-managers/meson/boost-Do-not-add-system-paths-on-nix.patch
deleted file mode 100644
index 0a2eda9de9a..00000000000
--- a/pkgs/development/tools/build-managers/meson/boost-Do-not-add-system-paths-on-nix.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-diff -Naur meson-0.60.2-old/mesonbuild/dependencies/boost.py meson-0.60.2-new/mesonbuild/dependencies/boost.py
---- meson-0.60.2-old/mesonbuild/dependencies/boost.py	2021-11-02 16:58:07.000000000 -0300
-+++ meson-0.60.2-new/mesonbuild/dependencies/boost.py	2021-12-12 19:21:27.895705897 -0300
-@@ -682,16 +682,7 @@
-         else:
-             tmp = []  # type: T.List[Path]
- 
--            # Add some default system paths
--            tmp += [Path('/opt/local')]
--            tmp += [Path('/usr/local/opt/boost')]
--            tmp += [Path('/usr/local')]
--            tmp += [Path('/usr')]
--
--            # Cleanup paths
--            tmp = [x for x in tmp if x.is_dir()]
--            tmp = [x.resolve() for x in tmp]
--            roots += tmp
-+            # Remove such spurious, non-explicit "system" paths for Nix&Nixpkgs
- 
-         self.check_and_set_roots(roots, use_system=True)
- 
diff --git a/pkgs/development/tools/build-managers/meson/clear-old-rpath.patch b/pkgs/development/tools/build-managers/meson/clear-old-rpath.patch
deleted file mode 100644
index f1e3c76e8b5..00000000000
--- a/pkgs/development/tools/build-managers/meson/clear-old-rpath.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-diff --git a/mesonbuild/scripts/depfixer.py b/mesonbuild/scripts/depfixer.py
-index 4176b9a03..faaabf616 100644
---- a/mesonbuild/scripts/depfixer.py
-+++ b/mesonbuild/scripts/depfixer.py
-@@ -336,6 +336,15 @@ class Elf(DataSizes):
-         if not new_rpath:
-             self.remove_rpath_entry(entrynum)
-         else:
-+            # Clear old rpath to avoid stale references,
-+            # not heeding the warning above about de-duplication
-+            # since it does not seem to cause issues for us
-+            # and not doing so trips up Nix’s reference checker.
-+            # See https://github.com/NixOS/nixpkgs/pull/46020
-+            # and https://github.com/NixOS/nixpkgs/issues/95163
-+            self.bf.seek(rp_off)
-+            self.bf.write(b'\0'*len(old_rpath))
-+
-             self.bf.seek(rp_off)
-             self.bf.write(new_rpath)
-             self.bf.write(b'\0')
diff --git a/pkgs/development/tools/build-managers/meson/default.nix b/pkgs/development/tools/build-managers/meson/default.nix
deleted file mode 100644
index 52220c4d0b9..00000000000
--- a/pkgs/development/tools/build-managers/meson/default.nix
+++ /dev/null
@@ -1,173 +0,0 @@
-{ lib
-, stdenv
-, fetchFromGitHub
-, fetchpatch
-, installShellFiles
-, rust
-, ninja
-, pkg-config
-, python3
-, zlib
-, coreutils
-, substituteAll
-, Foundation
-, OpenGL
-, AppKit
-, Cocoa
-, libxcrypt
-}:
-
-python3.pkgs.buildPythonApplication rec {
-  pname = "meson";
-  version = "1.2.0";
-
-  src = fetchFromGitHub {
-    owner = "mesonbuild";
-    repo = "meson";
-    rev = "refs/tags/${version}";
-    hash = "sha256-bJAmkE+sL9DqKpcjZdBf4/z9lz+m/o0Z87hlAwbVbTY=";
-  };
-
-  patches = [
-    # Meson is currently inspecting fewer variables than autoconf does, which
-    # makes it harder for us to use setup hooks, etc.  Taken from
-    # https://github.com/mesonbuild/meson/pull/6827
-    ./more-env-vars.patch
-
-    # Unlike libtool, vanilla Meson does not pass any information
-    # about the path library will be installed to to g-ir-scanner,
-    # breaking the GIR when path other than ${!outputLib}/lib is used.
-    # We patch Meson to add a --fallback-library-path argument with
-    # library install_dir to g-ir-scanner.
-    ./gir-fallback-path.patch
-
-    # In common distributions, RPATH is only needed for internal libraries so
-    # meson removes everything else. With Nix, the locations of libraries
-    # are not as predictable, therefore we need to keep them in the RPATH.
-    # At the moment we are keeping the paths starting with /nix/store.
-    # https://github.com/NixOS/nixpkgs/issues/31222#issuecomment-365811634
-    (substituteAll {
-      src = ./fix-rpath.patch;
-      inherit (builtins) storeDir;
-    })
-
-    # When Meson removes build_rpath from DT_RUNPATH entry, it just writes
-    # the shorter NUL-terminated new rpath over the old one to reduce
-    # the risk of potentially breaking the ELF files.
-    # But this can cause much bigger problem for Nix as it can produce
-    # cut-in-half-by-\0 store path references.
-    # Let’s just clear the whole rpath and hope for the best.
-    ./clear-old-rpath.patch
-
-    # Patch out default boost search paths to avoid impure builds on
-    # unsandboxed non-NixOS builds, see:
-    # https://github.com/NixOS/nixpkgs/issues/86131#issuecomment-711051774
-    ./boost-Do-not-add-system-paths-on-nix.patch
-
-    # Nixpkgs cctools does not have bitcode support.
-    ./disable-bitcode.patch
-
-    # Fix passing multiple --define-variable arguments to pkg-config.
-    # https://github.com/mesonbuild/meson/pull/10670
-    (fetchpatch {
-      url = "https://github.com/mesonbuild/meson/commit/d5252c5d4cf1c1931fef0c1c98dd66c000891d21.patch";
-      sha256 = "GiUNVul1N5Fl8mfqM7vA/r1FdKqImiDYLXMVDt77gvw=";
-      excludes = [
-        "docs/yaml/objects/dep.yaml"
-      ];
-    })
-  ];
-
-  cpuFamily = with stdenv.targetPlatform;
-    /**/ if isAarch32 then "arm"
-    else if isx86_32  then "x86"
-    else uname.processor;
-
-  crossFile = if stdenv.hostPlatform == stdenv.targetPlatform then null else
-    builtins.toFile "cross-file.conf" ''
-      [properties]
-      needs_exe_wrapper = ${lib.boolToString (!stdenv.hostPlatform.canExecute stdenv.targetPlatform)}
-
-      [host_machine]
-      system = '${stdenv.targetPlatform.parsed.kernel.name}'
-      cpu_family = '${cpuFamily}'
-      cpu = '${stdenv.targetPlatform.parsed.cpu.name}'
-      endian = ${if stdenv.targetPlatform.isLittleEndian then "'little'" else "'big'"}
-
-      [binaries]
-      llvm-config = 'llvm-config-native'
-      rust = ['rustc', '--target=${rust.toRustTargetSpec stdenv.targetPlatform}']
-    '';
-
-  setupHook = substituteAll {
-    src = ./setup-hook.sh;
-    crossFlags = lib.optionalString (crossFile != null) "--cross-file=${crossFile}";
-  };
-
-  nativeCheckInputs = [ ninja pkg-config ];
-  checkInputs = [ zlib ]
-    ++ lib.optionals stdenv.isDarwin [ Foundation OpenGL AppKit Cocoa ];
-  checkPhase = ''
-    runHook preCheck
-
-    patchShebangs 'test cases'
-    substituteInPlace 'test cases/native/8 external program shebang parsing/script.int.in' \
-      --replace /usr/bin/env ${coreutils}/bin/env
-    # requires git, creating cyclic dependency
-    rm -r 'test cases/common/66 vcstag'
-    # requires glib, creating cyclic dependency
-    rm -r 'test cases/linuxlike/6 subdir include order'
-    rm -r 'test cases/linuxlike/9 compiler checks with dependencies'
-    # requires static zlib, see #66461
-    rm -r 'test cases/linuxlike/14 static dynamic linkage'
-    # Nixpkgs cctools does not have bitcode support.
-    rm -r 'test cases/osx/7 bitcode'
-    HOME="$TMPDIR" python ./run_project_tests.py
-
-    runHook postCheck
-  '';
-
-  postFixup = ''
-    pushd $out/bin
-    # undo shell wrapper as meson tools are called with python
-    for i in *; do
-      mv ".$i-wrapped" "$i"
-    done
-    popd
-
-    # Do not propagate Python
-    rm $out/nix-support/propagated-build-inputs
-
-    substituteInPlace "$out/share/bash-completion/completions/meson" \
-      --replace "python3 -c " "${python3.interpreter} -c "
-  '';
-
-  buildInputs = lib.optionals (python3.pythonOlder "3.9") [
-    libxcrypt
-  ];
-
-  nativeBuildInputs = [ installShellFiles ];
-
-  postInstall = ''
-    installShellCompletion --zsh data/shell-completions/zsh/_meson
-    installShellCompletion --bash data/shell-completions/bash/meson
-  '';
-
-  meta = with lib; {
-    homepage = "https://mesonbuild.com";
-    description = "An open source, fast and friendly build system made in Python";
-    longDescription = ''
-      Meson is an open source build system meant to be both extremely fast, and,
-      even more importantly, as user friendly as possible.
-
-      The main design point of Meson is that every moment a developer spends
-      writing or debugging build definitions is a second wasted. So is every
-      second spent waiting for the build system to actually start compiling
-      code.
-    '';
-    license = licenses.asl20;
-    maintainers = with maintainers; [ mbe AndersonTorres ];
-    inherit (python3.meta) platforms;
-  };
-}
-# TODO: a more Nixpkgs-tailoired test suite
diff --git a/pkgs/development/tools/build-managers/meson/disable-bitcode.patch b/pkgs/development/tools/build-managers/meson/disable-bitcode.patch
deleted file mode 100644
index a72997c1043..00000000000
--- a/pkgs/development/tools/build-managers/meson/disable-bitcode.patch
+++ /dev/null
@@ -1,24 +0,0 @@
---- a/mesonbuild/compilers/mixins/clang.py
-+++ b/mesonbuild/compilers/mixins/clang.py
-@@ -56,10 +56,6 @@ class ClangCompiler(GnuLikeCompiler):
-             {OptionKey('b_colorout'), OptionKey('b_lto_threads'), OptionKey('b_lto_mode'), OptionKey('b_thinlto_cache'),
-              OptionKey('b_thinlto_cache_dir')})
- 
--        # TODO: this really should be part of the linker base_options, but
--        # linkers don't have base_options.
--        if isinstance(self.linker, AppleDynamicLinker):
--            self.base_options.add(OptionKey('b_bitcode'))
-         # All Clang backends can also do LLVM IR
-         self.can_compile_suffixes.add('ll')
- 
---- a/mesonbuild/linkers/linkers.py
-+++ b/mesonbuild/linkers/linkers.py
-@@ -785,7 +785,7 @@ class AppleDynamicLinker(PosixDynamicLinkerMixin, DynamicLinker):
-         return self._apply_prefix('-headerpad_max_install_names')
- 
-     def bitcode_args(self) -> T.List[str]:
--        return self._apply_prefix('-bitcode_bundle')
-+        raise MesonException('Nixpkgs cctools does not support bitcode bundles')
- 
-     def fatal_warnings(self) -> T.List[str]:
-         return self._apply_prefix('-fatal_warnings')
diff --git a/pkgs/development/tools/build-managers/meson/emulator-hook.sh b/pkgs/development/tools/build-managers/meson/emulator-hook.sh
deleted file mode 100644
index 4f08087cf5f..00000000000
--- a/pkgs/development/tools/build-managers/meson/emulator-hook.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-add_meson_exe_wrapper_cross_flag() {
-  mesonFlagsArray+=(--cross-file=@crossFile@)
-}
-
-preConfigureHooks+=(add_meson_exe_wrapper_cross_flag)
diff --git a/pkgs/development/tools/build-managers/meson/fix-rpath.patch b/pkgs/development/tools/build-managers/meson/fix-rpath.patch
deleted file mode 100644
index 29bec7903ca..00000000000
--- a/pkgs/development/tools/build-managers/meson/fix-rpath.patch
+++ /dev/null
@@ -1,24 +0,0 @@
---- a/mesonbuild/backend/backends.py
-+++ b/mesonbuild/backend/backends.py
-@@ -723,6 +723,21 @@
-     @staticmethod
-     def get_rpath_dirs_from_link_args(args: T.List[str]) -> T.Set[str]:
-         dirs: T.Set[str] = set()
-+
-+        nix_ldflags = os.environ.get('NIX_LDFLAGS', '').split()
-+        next_is_path = False
-+        # Try to add rpaths set by user or ld-wrapper so that they are not removed.
-+        # Based on https://github.com/NixOS/nixpkgs/blob/69711a2f5ffe8cda208163be5258266172ff527f/pkgs/build-support/bintools-wrapper/ld-wrapper.sh#L148-L177
-+        for flag in nix_ldflags:
-+            if flag == '-rpath' or flag == '-L':
-+                next_is_path = True
-+            elif next_is_path or flag.startswith('-L/'):
-+                if flag.startswith('-L/'):
-+                    flag = flag[2:]
-+                if flag.startswith('@storeDir@'):
-+                    dirs.add(flag)
-+                next_is_path = False
-+
-         # Match rpath formats:
-         # -Wl,-rpath=
-         # -Wl,-rpath,
diff --git a/pkgs/development/tools/build-managers/meson/gir-fallback-path.patch b/pkgs/development/tools/build-managers/meson/gir-fallback-path.patch
deleted file mode 100644
index e6d74026527..00000000000
--- a/pkgs/development/tools/build-managers/meson/gir-fallback-path.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
-index 1c6952df7..9466a0b7d 100644
---- a/mesonbuild/modules/gnome.py
-+++ b/mesonbuild/modules/gnome.py
-@@ -923,6 +923,16 @@ class GnomeModule(ExtensionModule):
-         if fatal_warnings:
-             scan_command.append('--warn-error')
-
-+        if len(set(girtarget.get_custom_install_dir()[0] for girtarget in girtargets if girtarget.get_custom_install_dir())) > 1:
-+            raise MesonException('generate_gir tries to build multiple libraries with different install_dir at once: {}'.format(','.join([str(girtarget) for girtarget in girtargets])))
-+
-+        if girtargets[0].get_custom_install_dir():
-+            fallback_libpath = girtargets[0].get_custom_install_dir()[0]
-+        else:
-+            fallback_libpath = None
-+        if fallback_libpath is not None and isinstance(fallback_libpath, str) and len(fallback_libpath) > 0 and fallback_libpath[0] == "/":
-+            scan_command += ['--fallback-library-path=' + fallback_libpath]
-+
-         generated_files = [f for f in libsources if isinstance(f, (GeneratedList, CustomTarget, CustomTargetIndex))]
- 
-         scan_target = self._make_gir_target(state, girfile, scan_command, generated_files, depends, kwargs)
diff --git a/pkgs/development/tools/build-managers/meson/more-env-vars.patch b/pkgs/development/tools/build-managers/meson/more-env-vars.patch
deleted file mode 100644
index e4ad4355042..00000000000
--- a/pkgs/development/tools/build-managers/meson/more-env-vars.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -Naur meson-0.60.2-old/mesonbuild/environment.py meson-0.60.2-new/mesonbuild/environment.py
---- meson-0.60.2-old/mesonbuild/environment.py	2021-11-02 16:58:13.000000000 -0300
-+++ meson-0.60.2-new/mesonbuild/environment.py	2021-12-12 17:44:00.350499307 -0300
-@@ -68,7 +68,7 @@
-         # compiling we fall back on the unprefixed host version. This
-         # allows native builds to never need to worry about the 'BUILD_*'
-         # ones.
--        ([var_name + '_FOR_BUILD'] if is_cross else [var_name]),
-+        [var_name + '_FOR_BUILD'] + ([] if is_cross else [var_name]),
-         # Always just the unprefixed host versions
-         [var_name]
-     )[for_machine]
diff --git a/pkgs/development/tools/build-managers/meson/setup-hook.sh b/pkgs/development/tools/build-managers/meson/setup-hook.sh
deleted file mode 100644
index d1c07349b11..00000000000
--- a/pkgs/development/tools/build-managers/meson/setup-hook.sh
+++ /dev/null
@@ -1,42 +0,0 @@
-mesonConfigurePhase() {
-    runHook preConfigure
-
-    if [ -z "${dontAddPrefix-}" ]; then
-        mesonFlags="--prefix=$prefix $mesonFlags"
-    fi
-
-    # See multiple-outputs.sh and meson’s coredata.py
-    mesonFlags="@crossFlags@ \
-        --libdir=${!outputLib}/lib --libexecdir=${!outputLib}/libexec \
-        --bindir=${!outputBin}/bin --sbindir=${!outputBin}/sbin \
-        --includedir=${!outputInclude}/include \
-        --mandir=${!outputMan}/share/man --infodir=${!outputInfo}/share/info \
-        --localedir=${!outputLib}/share/locale \
-        -Dauto_features=${mesonAutoFeatures:-enabled} \
-        -Dwrap_mode=${mesonWrapMode:-nodownload} \
-        $mesonFlags"
-
-    mesonFlags="${crossMesonFlags+$crossMesonFlags }--buildtype=${mesonBuildType:-plain} $mesonFlags"
-
-    echo "meson flags: $mesonFlags ${mesonFlagsArray[@]}"
-
-    meson setup build $mesonFlags "${mesonFlagsArray[@]}"
-    cd build
-
-    if ! [[ -v enableParallelBuilding ]]; then
-        enableParallelBuilding=1
-        echo "meson: enabled parallel building"
-    fi
-
-    if ! [[ -v enableParallelInstalling ]]; then
-        enableParallelInstalling=1
-        echo "meson: enabled parallel installing"
-    fi
-
-    runHook postConfigure
-}
-
-if [ -z "${dontUseMesonConfigure-}" -a -z "${configurePhase-}" ]; then
-    setOutputFlags=
-    configurePhase=mesonConfigurePhase
-fi