summary refs log tree commit diff
path: root/pkgs/development/tools/build-managers
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/tools/build-managers')
-rw-r--r--pkgs/development/tools/build-managers/cmake/001-search-path.diff40
-rw-r--r--pkgs/development/tools/build-managers/meson/allow-dirs-outside-of-prefix.patch19
-rw-r--r--pkgs/development/tools/build-managers/meson/default.nix34
-rw-r--r--pkgs/development/tools/build-managers/meson/fix-gtkdoc-when-using-multiple-apple-frameworks.patch162
4 files changed, 47 insertions, 208 deletions
diff --git a/pkgs/development/tools/build-managers/cmake/001-search-path.diff b/pkgs/development/tools/build-managers/cmake/001-search-path.diff
index b71c2dd4441..c059bf5bffc 100644
--- a/pkgs/development/tools/build-managers/cmake/001-search-path.diff
+++ b/pkgs/development/tools/build-managers/cmake/001-search-path.diff
@@ -1,5 +1,5 @@
 diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake
-index b9381c3d7d..cecc40a89e 100644
+index b9381c3d7d..5e944640b5 100644
 --- a/Modules/Platform/UnixPaths.cmake
 +++ b/Modules/Platform/UnixPaths.cmake
 @@ -26,9 +26,6 @@ get_filename_component(_CMAKE_INSTALL_DIR "${_CMAKE_INSTALL_DIR}" PATH)
@@ -12,7 +12,7 @@ index b9381c3d7d..cecc40a89e 100644
    # CMake install location
    "${_CMAKE_INSTALL_DIR}"
    )
-@@ -47,24 +44,19 @@ endif()
+@@ -47,48 +44,46 @@ endif()
  
  # Non "standard" but common install prefixes
  list(APPEND CMAKE_SYSTEM_PREFIX_PATH
@@ -22,43 +22,61 @@ index b9381c3d7d..cecc40a89e 100644
    )
  
  # List common include file locations not under the common prefixes.
++if(IS_DIRECTORY $ENV{NIX_CC})
++  file(STRINGS "$ENV{NIX_CC}/nix-support/orig-libc" _nix_cmake_libc)
++  file(STRINGS "$ENV{NIX_CC}/nix-support/orig-libc-dev" _nix_cmake_libc_dev)
++else()
++  set(_nix_cmake_libc @libc_lib@)
++  set(_nix_cmake_libc_dev @libc_dev@)
++endif()
++
  list(APPEND CMAKE_SYSTEM_INCLUDE_PATH
 -  # X11
 -  /usr/include/X11
-+  @libc_dev@/include
++  "${_nix_cmake_libc_dev}/include"
    )
  
  list(APPEND CMAKE_SYSTEM_LIBRARY_PATH
 -  # X11
 -  /usr/lib/X11
-+  @libc_lib@/lib
++  "${_nix_cmake_libc}/lib"
    )
  
  list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
 -  /lib /lib32 /lib64 /usr/lib /usr/lib32 /usr/lib64
-+  @libc_lib@/lib
++  "${_nix_cmake_libc}/lib"
    )
  
- if(CMAKE_SYSROOT_COMPILE)
-@@ -77,15 +69,15 @@ endif()
+-if(CMAKE_SYSROOT_COMPILE)
+-  set(_cmake_sysroot_compile "${CMAKE_SYSROOT_COMPILE}")
+-else()
+-  set(_cmake_sysroot_compile "${CMAKE_SYSROOT}")
+-endif()
+-
+ # Default per-language values.  These may be later replaced after
  # parsing the implicit directory information from compiler output.
  set(_CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES_INIT
    ${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}
 -  "${_cmake_sysroot_compile}/usr/include"
-+  @libc_dev@/include
++  "${_nix_cmake_libc_dev}/include"
    )
  set(_CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES_INIT
    ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}
 -  "${_cmake_sysroot_compile}/usr/include"
-+  @libc_dev@/include
++  "${_nix_cmake_libc_dev}/include"
    )
  set(_CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES_INIT
    ${CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES}
 -  "${_cmake_sysroot_compile}/usr/include"
-+  @libc_dev@/include
++  "${_nix_cmake_libc_dev}/include"
    )
  
- unset(_cmake_sysroot_compile)
+-unset(_cmake_sysroot_compile)
++unset(_nix_cmake_libc)
++unset(_nix_cmake_libc_dev)
+ 
+ # Reminder when adding new locations computed from environment variables
+ # please make sure to keep Help/variable/CMAKE_SYSTEM_PREFIX_PATH.rst
 diff --git a/Modules/Platform/WindowsPaths.cmake b/Modules/Platform/WindowsPaths.cmake
 index b9e2f17979..ab517cd4a7 100644
 --- a/Modules/Platform/WindowsPaths.cmake
diff --git a/pkgs/development/tools/build-managers/meson/allow-dirs-outside-of-prefix.patch b/pkgs/development/tools/build-managers/meson/allow-dirs-outside-of-prefix.patch
deleted file mode 100644
index 4eb292a2e52..00000000000
--- a/pkgs/development/tools/build-managers/meson/allow-dirs-outside-of-prefix.patch
+++ /dev/null
@@ -1,19 +0,0 @@
---- a/mesonbuild/coredata.py
-+++ b/mesonbuild/coredata.py
-@@ -506,7 +506,6 @@ class CoreData:
-             return value
-         if option.name.endswith('dir') and value.is_absolute() and \
-            option not in BULITIN_DIR_NOPREFIX_OPTIONS:
--            # Value must be a subdir of the prefix
-             # commonpath will always return a path in the native format, so we
-             # must use pathlib.PurePath to do the same conversion before
-             # comparing.
-@@ -518,7 +517,7 @@ class CoreData:
-             try:
-                 value = value.relative_to(prefix)
-             except ValueError:
--                raise MesonException(msg.format(option, value, prefix))
-+                pass
-             if '..' in str(value):
-                 raise MesonException(msg.format(option, value, prefix))
-         return value.as_posix()
diff --git a/pkgs/development/tools/build-managers/meson/default.nix b/pkgs/development/tools/build-managers/meson/default.nix
index 5a9164d426a..b28c3a64cc2 100644
--- a/pkgs/development/tools/build-managers/meson/default.nix
+++ b/pkgs/development/tools/build-managers/meson/default.nix
@@ -10,20 +10,14 @@
 
 python3.pkgs.buildPythonApplication rec {
   pname = "meson";
-  version = "0.61.2";
+  version = "0.63.0";
 
   src = python3.pkgs.fetchPypi {
     inherit pname version;
-    hash = "sha256-AjOn+NlZB5MY9gUrCTnCf2il3oa6YB8lye5oaftfWIk=";
+    sha256 = "sha256-O1HUUXRMK8cYOFJOyNls1PjEeT1bjV0NCpyKT3yUzW8=";
   };
 
   patches = [
-    # Upstream insists on not allowing bindir and other dir options
-    # outside of prefix for some reason:
-    # https://github.com/mesonbuild/meson/issues/2561
-    # We remove the check so multiple outputs can work sanely.
-    ./allow-dirs-outside-of-prefix.patch
-
     # 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
@@ -67,16 +61,24 @@ python3.pkgs.buildPythonApplication rec {
     # https://github.com/NixOS/nixpkgs/issues/86131#issuecomment-711051774
     ./boost-Do-not-add-system-paths-on-nix.patch
 
-    # https://github.com/mesonbuild/meson/pull/9841
-    # cross-compilation fix
+    # Prevent Meson from passing -O0 in buildtype=plain.
+    # Nixpkgs enables fortifications which do not work without optimizations.
+    # https://github.com/mesonbuild/meson/pull/10593
+    (fetchpatch {
+      url = "https://github.com/mesonbuild/meson/commit/f9bfeb2add70973113ab4a98454a5c5d7e3a26ae.patch";
+      revert = true;
+      sha256 = "VKXUwdS+zMp1y+5GrV2inESUpUUp+OL3aI4wOXHxOeo=";
+    })
+
+    # Fix passing multiple --define-variable arguments to pkg-config.
+    # https://github.com/mesonbuild/meson/pull/10670
     (fetchpatch {
-      url = "https://github.com/mesonbuild/meson/commit/266e8acb5807b38a550cb5145cea0e19545a21d7.patch";
-      sha256 = "sha256-1GdKsm2xvq2GxTNeTyBH5O73hxboL0YI+w2BCoUeWXM=";
+      url = "https://github.com/mesonbuild/meson/commit/d5252c5d4cf1c1931fef0c1c98dd66c000891d21.patch";
+      sha256 = "GiUNVul1N5Fl8mfqM7vA/r1FdKqImiDYLXMVDt77gvw=";
+      excludes = [
+        "docs/yaml/objects/dep.yaml"
+      ];
     })
-  ] ++ lib.optionals withDarwinFrameworksGtkDocPatch [
-    # Fix building gtkdoc for GLib
-    # https://github.com/mesonbuild/meson/pull/10186
-    ./fix-gtkdoc-when-using-multiple-apple-frameworks.patch
   ];
 
   setupHook = ./setup-hook.sh;
diff --git a/pkgs/development/tools/build-managers/meson/fix-gtkdoc-when-using-multiple-apple-frameworks.patch b/pkgs/development/tools/build-managers/meson/fix-gtkdoc-when-using-multiple-apple-frameworks.patch
deleted file mode 100644
index 6c237e92dd1..00000000000
--- a/pkgs/development/tools/build-managers/meson/fix-gtkdoc-when-using-multiple-apple-frameworks.patch
+++ /dev/null
@@ -1,162 +0,0 @@
-From b8ba462ae72e0818898357464263ec84722f6d4c Mon Sep 17 00:00:00 2001
-From: Jan Tojnar <jtojnar@gmail.com>
-Date: Sat, 26 Mar 2022 02:26:27 +0100
-Subject: [PATCH] gnome: Fix gtkdoc when using multiple Apple frameworks
-
-The `-framework Foundation -framework CoreFoundation` ended up
-de-duplicated by OrderedSet into `-framework Foundation CoreFoundation`.
-
-Picked from https://github.com/mesonbuild/meson/pull/10186
-
-Also pick https://github.com/mesonbuild/meson/commit/68e684d51f1e469e0d9f4b499ffda15146cad98a when resolving conflict.
-
-diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
-index 214f97ac3..0521b2605 100644
---- a/mesonbuild/modules/gnome.py
-+++ b/mesonbuild/modules/gnome.py
-@@ -593,15 +593,16 @@ class GnomeModule(ExtensionModule):
-                        lib: T.Union[build.SharedLibrary, build.StaticLibrary],
-                        depends: T.List[build.BuildTarget],
-                        include_rpath: bool = False,
--                       use_gir_args: bool = False) -> T.List[str]:
-+                       use_gir_args: bool = False) -> T.Tuple[T.List[str], T.List[T.Union[build.BuildTarget, 'build.GeneratedTypes', 'FileOrString']]]:
-         link_command: T.List[str] = []
-+        new_depends = list(depends)
-         # Construct link args
-         if isinstance(lib, build.SharedLibrary):
-             libdir = os.path.join(state.environment.get_build_dir(), state.backend.get_target_dir(lib))
-             link_command.append('-L' + libdir)
-             if include_rpath:
-                 link_command.append('-Wl,-rpath,' + libdir)
--            depends.append(lib)
-+            new_depends.append(lib)
-             # Needed for the following binutils bug:
-             # https://github.com/mesonbuild/meson/issues/1911
-             # However, g-ir-scanner does not understand -Wl,-rpath
-@@ -615,19 +616,19 @@ class GnomeModule(ExtensionModule):
-             link_command.append('--extra-library=' + lib.name)
-         else:
-             link_command.append('-l' + lib.name)
--        return link_command
-+        return link_command, new_depends
- 
--    def _get_dependencies_flags(
-+    def _get_dependencies_flags_raw(
-             self, deps: T.Sequence[T.Union['Dependency', build.SharedLibrary, build.StaticLibrary]],
--            state: 'ModuleState', depends: T.List[build.BuildTarget], include_rpath: bool = False,
--            use_gir_args: bool = False, separate_nodedup: bool = False
--            ) -> T.Tuple[OrderedSet[str], OrderedSet[str], OrderedSet[str], T.Optional[T.List[str]], OrderedSet[str]]:
-+            state: 'ModuleState', depends: T.List[build.BuildTarget], include_rpath: bool,
-+            use_gir_args: bool
-+            ) -> T.Tuple[OrderedSet[str], OrderedSet[T.Union[str, T.Tuple[str, str]]], OrderedSet[T.Union[str, T.Tuple[str, str]]], T.Optional[T.List[str]], OrderedSet[str],
-+                         T.List[T.Union[build.BuildTarget, 'build.GeneratedTypes', 'FileOrString']]]:
-         cflags: OrderedSet[str] = OrderedSet()
--        internal_ldflags: OrderedSet[str] = OrderedSet()
--        external_ldflags: OrderedSet[str] = OrderedSet()
-         # External linker flags that can't be de-duped reliably because they
--        # require two args in order, such as -framework AVFoundation
--        external_ldflags_nodedup: T.List[str] = []
-+        # require two args in order, such as -framework AVFoundation will be stored as a tuple.
-+        internal_ldflags: OrderedSet[T.Union[str, T.Tuple[str, str]]] = OrderedSet()
-+        external_ldflags: OrderedSet[T.Union[str, T.Tuple[str, str]]] = OrderedSet()
-         gi_includes: OrderedSet[str] = OrderedSet()
-         deps = mesonlib.listify(deps)
- 
-@@ -642,21 +643,20 @@ class GnomeModule(ExtensionModule):
-                 cflags.update(state.get_include_args(dep.include_directories))
-                 for lib in dep.libraries:
-                     if isinstance(lib, build.SharedLibrary):
--                        internal_ldflags.update(self._get_link_args(state, lib, depends, include_rpath))
--                        libdepflags = self._get_dependencies_flags(lib.get_external_deps(), state, depends, include_rpath,
--                                                                   use_gir_args, True)
-+                        _ld, depends = self._get_link_args(state, lib, depends, include_rpath)
-+                        internal_ldflags.update(_ld)
-+                        libdepflags = self._get_dependencies_flags_raw(lib.get_external_deps(), state, depends, include_rpath,
-+                                                                   use_gir_args)
-                         cflags.update(libdepflags[0])
-                         internal_ldflags.update(libdepflags[1])
-                         external_ldflags.update(libdepflags[2])
--                        external_ldflags_nodedup += libdepflags[3]
--                        gi_includes.update(libdepflags[4])
--                extdepflags = self._get_dependencies_flags(dep.ext_deps, state, depends, include_rpath,
--                                                           use_gir_args, True)
-+                        gi_includes.update(libdepflags[3])
-+                extdepflags = self._get_dependencies_flags_raw(dep.ext_deps, state, depends, include_rpath,
-+                                                           use_gir_args)
-                 cflags.update(extdepflags[0])
-                 internal_ldflags.update(extdepflags[1])
-                 external_ldflags.update(extdepflags[2])
--                external_ldflags_nodedup += extdepflags[3]
--                gi_includes.update(extdepflags[4])
-+                gi_includes.update(extdepflags[3])
-                 for source in dep.sources:
-                     if isinstance(source, GirTarget):
-                         gi_includes.update([os.path.join(state.environment.get_build_dir(),
-@@ -684,7 +684,7 @@ class GnomeModule(ExtensionModule):
-                     # If it's a framework arg, slurp the framework name too
-                     # to preserve the order of arguments
-                     if flag == '-framework':
--                        external_ldflags_nodedup += [flag, next(ldflags)]
-+                        external_ldflags.update([(flag, next(ldflags))])
-                     else:
-                         external_ldflags.update([flag])
-             elif isinstance(dep, (build.StaticLibrary, build.SharedLibrary)):
-@@ -695,21 +695,41 @@ class GnomeModule(ExtensionModule):
-                 continue
- 
-         if use_gir_args and self._gir_has_option('--extra-library'):
--            def fix_ldflags(ldflags: T.Iterable[str]) -> OrderedSet[str]:
--                fixed_ldflags: OrderedSet[str] = OrderedSet()
-+            def fix_ldflags(ldflags: T.Iterable[T.Union[str, T.Tuple[str, str]]]) -> OrderedSet[T.Union[str, T.Tuple[str, str]]]:
-+                fixed_ldflags: OrderedSet[T.Union[str, T.Tuple[str, str]]] = OrderedSet()
-                 for ldflag in ldflags:
--                    if ldflag.startswith("-l"):
-+                    if isinstance(ldflag, str) and ldflag.startswith("-l"):
-                         ldflag = ldflag.replace('-l', '--extra-library=', 1)
-                     fixed_ldflags.add(ldflag)
-                 return fixed_ldflags
-             internal_ldflags = fix_ldflags(internal_ldflags)
-             external_ldflags = fix_ldflags(external_ldflags)
--        if not separate_nodedup:
--            external_ldflags.update(external_ldflags_nodedup)
--            return cflags, internal_ldflags, external_ldflags, None, gi_includes
--        else:
--            return cflags, internal_ldflags, external_ldflags, external_ldflags_nodedup, gi_includes
-+        return cflags, internal_ldflags, external_ldflags, gi_includes, depends
-+
-+    def _get_dependencies_flags(
-+            self, deps: T.Sequence[T.Union['Dependency', build.SharedLibrary, build.StaticLibrary]],
-+            state: 'ModuleState', depends: T.List[build.BuildTarget], include_rpath: bool = False,
-+            use_gir_args: bool = False
-+            ) -> T.Tuple[OrderedSet[str], T.List[str], T.List[str], OrderedSet[str],
-+                         T.List[T.Union[build.BuildTarget, 'build.GeneratedTypes', 'FileOrString']]]:
-+
-+        cflags, internal_ldflags_raw, external_ldflags_raw, gi_includes, depends = self._get_dependencies_flags_raw(deps, state, depends, include_rpath, use_gir_args)
-+        internal_ldflags: T.List[str] = []
-+        external_ldflags: T.List[str] = []
-+
-+        # Extract non-deduplicable argument groups out of the tuples.
-+        for ldflag in internal_ldflags_raw:
-+            if isinstance(ldflag, str):
-+                internal_ldflags.append(ldflag)
-+            else:
-+                internal_ldflags.extend(ldflag)
-+        for ldflag in external_ldflags_raw:
-+            if isinstance(ldflag, str):
-+                external_ldflags.append(ldflag)
-+            else:
-+                external_ldflags.extend(ldflag)
- 
-+        return cflags, internal_ldflags, external_ldflags, gi_includes, depends
-     def _unwrap_gir_target(self, girtarget: T.Union[build.Executable, build.StaticLibrary, build.SharedLibrary], state: 'ModuleState'
-                            ) -> T.Union[build.Executable, build.StaticLibrary, build.SharedLibrary]:
-         if not isinstance(girtarget, (build.Executable, build.SharedLibrary,
-@@ -1056,7 +1076,7 @@ class GnomeModule(ExtensionModule):
-         # ldflags will be misinterpreted by gir scanner (showing
-         # spurious dependencies) but building GStreamer fails if they
-         # are not used here.
--        dep_cflags, dep_internal_ldflags, dep_external_ldflags, _, gi_includes = \
-+        dep_cflags, dep_internal_ldflags, dep_external_ldflags, gi_includes, depends = \
-             self._get_dependencies_flags(deps, state, depends, use_gir_args=True)
-         scan_cflags = []
-         scan_cflags += list(self._get_scanner_cflags(cflags))