From 60f3b8abd9d419c83ba04f9cd7cba919ff7b223c Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Tue, 9 Jan 2024 08:03:11 +0100 Subject: [PATCH 1/8] [libdrm] New port --- ports/libdrm/copyright/MIT-style | 322 +++++++++++++++++++++++++++ ports/libdrm/copyright/etnaviv_drm.h | 16 ++ ports/libdrm/copyright/uthash.h | 20 ++ ports/libdrm/portfile.cmake | 36 +++ ports/libdrm/vcpkg.json | 14 ++ versions/baseline.json | 4 + versions/l-/libdrm.json | 9 + 7 files changed, 421 insertions(+) create mode 100644 ports/libdrm/copyright/MIT-style create mode 100644 ports/libdrm/copyright/etnaviv_drm.h create mode 100644 ports/libdrm/copyright/uthash.h create mode 100644 ports/libdrm/portfile.cmake create mode 100644 ports/libdrm/vcpkg.json create mode 100644 versions/l-/libdrm.json diff --git a/ports/libdrm/copyright/MIT-style b/ports/libdrm/copyright/MIT-style new file mode 100644 index 00000000000000..5dac838b2e2ad4 --- /dev/null +++ b/ports/libdrm/copyright/MIT-style @@ -0,0 +1,322 @@ +Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. +Copyright 2000 VA Linux Systems, Inc. +All Rights Reserved. + +Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. +Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. + +GLX Hardware Device Driver common code +Copyright (C) 1999 Wittawat Yamwong + +Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. +All Rights Reserved. +Authors: Rickard E. (Rik) Faith + +Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. +Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. +All Rights Reserved. + +Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. +Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. +All Rights Reserved. + +Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. +Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. +All rights reserved. +Authors: + Jeff Hartmann + Keith Whitwell +Rewritten by: + Gareth Hughes + +Copyright 2000 Gareth Hughes +Copyright 2002 Frank C. Earl +Copyright 2002-2003 Leif Delgass +All Rights Reserved. +Authors: + Gareth Hughes + Frank C. Earl + Leif Delgass + +Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. +Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. +All rights reserved. +Authors: + Gareth Hughes + Kevin E. Martin + +Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. +Copyright 2000 VA Linux Systems, Inc., Fremont, California. +Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas. +All rights reserved. +Authors: + Kevin E. Martin + Gareth Hughes + Keith Whitwell + +Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. +Copyright 2000 VA Linux Systems, Inc., Fremont, California. +Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas. +Copyright 2014 Advanced Micro Devices, Inc. +Authors: + Kevin E. Martin + Gareth Hughes + Keith Whitwell + +Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas. +All Rights Reserved. + +Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. +All Rights Reserved. + +Copyright 2004 Felix Kuehling +All Rights Reserved. + +Copyright 2005 Eric Anholt +All Rights Reserved. + +Copyright 2005 Stephane Marchesin. +All Rights Reserved. + +Copyright 2006 Tungsten Graphics, Inc., Cedar Park, Texas. +All Rights Reserved. + +Copyright (c) 2007 Dave Airlie +Copyright (c) 2007 Jakob Bornecrantz +Copyright (c) 2008 Red Hat Inc. +Copyright (c) 2007-2008 Tungsten Graphics, Inc., Cedar Park, TX., USA +Copyright (c) 2007-2008 Intel Corporation + +Copyright © 2007 Intel Corporation +Authors: + Eric Anholt + +Copyright © 2007 Red Hat Inc. +Copyright © 2007-2012 Intel Corporation +Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND., USA +All Rights Reserved. + +Copyright 2007 Tungsten Graphics, Inc., Cedar Park, TX., USA +All Rights Reserved. + +Copyright (c) 2007-2008 Tungsten Graphics, Inc., Cedar Park, Texas. +Copyright (c) 2007-2008 Jakob Bornecrantz + +Copyright (c) 2007-2008 Tungsten Graphics, Inc., Cedar Park, Texas. +Copyright (c) 2007-2008 Dave Airlie +Copyright (c) 2007-2008 Jakob Bornecrantz + +Copyright © 2008 Dave Airlie +Copyright © 2008 Jérôme Glisse +All Rights Reserved. + +Copyright © 2008 Intel Corporation +Authors: + Eric Anholt + +Copyright © 2008-2012 Intel Corporation +Authors: + Eric Anholt + +Copyright © 2008 Jérôme Glisse +All Rights Reserved. + +Copyright © 2008 Nicolai Haehnle +Copyright © 2008 Jérôme Glisse +All Rights Reserved. + +Copyright 2008 Tungsten Graphics + Jakob Bornecrantz +Copyright 2008 Intel Corporation + Jesse Barnes + +DRM based mode setting test program +Copyright 2008 Tungsten Graphics + Jakob Bornecrantz +Copyright 2008 Intel Corporation + Jesse Barnes + +DRM based vblank test program +Copyright 2008 Tungsten Graphics + Jakob Bornecrantz +Copyright 2008 Intel Corporation + Jesse Barnes + +Copyright © 2009 Intel Corporation +Authors: + Chris Wilson + +Copyright © 2009-2011 Intel Corporation + +Copyright © 2009 Red Hat Inc. +All Rights Reserved. + +Copyright © 2009-2015 VMware, Inc., Palo Alto, CA., USA +All Rights Reserved. + +Copyright (C) 2010-2011 Chia-I Wu +Copyright (C) 2010-2011 LunarG Inc. +Copyright (C) 2016 Linaro, Ltd., Rob Herring +Copyright (C) 2018 Collabora, Robert Foss + +Copyright © 2010 Intel Corporation +Authors: + Eric Anholt + +Copyright 2010 Jerome Glisse +Authors: + Jerome Glisse + +Copyright 2011 Intel Corporation + +Copyright © 2011 Intel Corporation +Authors: + Ben Widawsky + +Copyright © 2011 Intel Corporation +Copyright © 2011-2012 Intel Corporation +Copyright © 2017 Intel Corporation +Copyright © 2017-2018 Intel Corporation +Copyright © 2018 Intel Corporation + +Copyright 2011 Luc Verhaegen + +Copyright © 2011 Red Hat +All Rights Reserved. + +Copyright © 2011 Red Hat +Authors: + Jerome Glisse + +Copyright (c) 2011 Samsung Electronics Co., Ltd. +Authors: +* Inki Dae +* Joonyoung Shim +* Seung-Woo Kim + +Copyright (C) 2011 Texas Instruments, Inc +Authors: + Rob Clark + +Copyright © 2012 Intel Corporation +Authors: + Paulo Zanoni + +Copyright 2012 Red Hat Inc. +Authors: Ben Skeggs + +Copyright (C) 2012 Rob Clark +Authors: + Rob Clark + +Copyright (C) 2012 Samsung Electronics Co., Ltd. +Authors: + Inki Dae + +Copyright © 2012, 2013 Thierry Reding +Copyright © 2013 Erik Faye-Lund +Copyright © 2014 NVIDIA Corporation +Copyright © 2015 NVIDIA Corporation +Copyright © 2014-2021 NVIDIA Corporation + +Copyright (C) 2012-2016 by the following authors: +- Wladimir J. van der Laan +- Christian Gmeiner +- Lucas Stach +- Russell King + +Copyright 2013 Red Hat +All Rights Reserved. + +DRM based mode setting test program +Copyright (C) 2013 Red Hat +Author: Rob Clark + +Copyright (C) 2013 Rob Clark +Authors: + Rob Clark + +Copyright (C) 2013 Red Hat +Author: Rob Clark + +Copyright (C) 2013 Samsung Electronics Co.Ltd +Authors: +* Inki Dae + +Copyright © 2014 Advanced Micro Devices, Inc. +All Rights Reserved. +Copyright © 2017 Advanced Micro Devices, Inc. +All Rights Reserved. +Copyright 2014 Advanced Micro Devices, Inc. +Copyright 2015 Advanced Micro Devices, Inc. +Copyright 2017 Advanced Micro Devices, Inc. +Copyright 2018 Advanced Micro Devices, Inc. +Copyright 2019 Advanced Micro Devices, Inc. +Copyright 2021 Advanced Micro Devices, Inc. +Copyright 2022 Advanced Micro Devices, Inc. + +Copyright © 2014 Broadcom + +Copyright © 2014-2015 Broadcom + +Copyright (C) 2014-2015 Etnaviv Project +Authors: + Christian Gmeiner + +Copyright © 2014 NVIDIA Corporation +Copyright © 2016-2018 NVIDIA Corporation +Copyright © 2018 NVIDIA Corporation + +DRM based mode setting test program +Copyright (C) 2014 Red Hat +Author: Rob Clark + +Copyright © 2015 Canonical Ltd. (Maarten Lankhorst) + +sync abstraction +Copyright 2015-2016 Collabora Ltd. +Based on the implementation from the Android Open Source Project, +Copyright 2012 Google, Inc + +Copyright (c) 2015 Emil Velikov + +Copyright (C) 2015 Etnaviv Project +Authors: + Christian Gmeiner + +Copyright (C) 2015 - Tobias Jakobi + +Copyright (C) 2016 Etnaviv Project +Authors: + Christian Gmeiner + +Copyright (C) 2016 Rob Clark +Authors: + Rob Clark + +Copyright (C) 2017 Etnaviv Project +Copyright (C) 2017 Zodiac Inflight Innovations +Authors: + Christian Gmeiner + +Copyright 2021 Collabora, Ltd. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice (including the next +paragraph) shall be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS +OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/ports/libdrm/copyright/etnaviv_drm.h b/ports/libdrm/copyright/etnaviv_drm.h new file mode 100644 index 00000000000000..6bf0a3de10e135 --- /dev/null +++ b/ports/libdrm/copyright/etnaviv_drm.h @@ -0,0 +1,16 @@ +SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note + +Copyright (C) 2015 Etnaviv Project + +This program is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License version 2 as published by +the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +more details. + +You should have received a copy of the GNU General Public License along with +this program. If not, see . + diff --git a/ports/libdrm/copyright/uthash.h b/ports/libdrm/copyright/uthash.h new file mode 100644 index 00000000000000..279b6e90ddcd45 --- /dev/null +++ b/ports/libdrm/copyright/uthash.h @@ -0,0 +1,20 @@ +Copyright (c) 2003-2016, Troy D. Hanson http://troydhanson.github.com/uthash/ +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/ports/libdrm/portfile.cmake b/ports/libdrm/portfile.cmake new file mode 100644 index 00000000000000..b0856931fbf02e --- /dev/null +++ b/ports/libdrm/portfile.cmake @@ -0,0 +1,36 @@ +vcpkg_from_gitlab( + GITLAB_URL https://gitlab.freedesktop.org + OUT_SOURCE_PATH SOURCE_PATH + REPO mesa/drm + REF libdrm-${VERSION} + SHA512 8a15f194c223f8c0f011bb9b0fa6b2ce8a2e0101cad3a6b27a62de7727f42098d0f4af156b058a254f8d9e189dec18c427cad2a7bee140d7a61c42828a1d1571 + HEAD_REF main +) + +vcpkg_configure_meson( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -Dcairo-tests=disabled + -Dman-pages=disabled + -Dtests=false + -Dvalgrind=disabled +) +vcpkg_install_meson() +vcpkg_fixup_pkgconfig() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") + +vcpkg_list(SET copyright_files + "${CURRENT_PORT_DIR}/copyright/MIT-style" + "${CURRENT_PORT_DIR}/copyright/uthash.h" +) +if(EXISTS "${CURRENT_PACKAGES_DIR}/include/libdrm/etnaviv_drmif.h") + vcpkg_list(APPEND copyright_files "${CURRENT_PORT_DIR}/copyright/etnaviv_drm.h") +endif() + +vcpkg_install_copyright(FILE_LIST ${copyright_files} COMMENT [[ +Most source files are under similar MIT-style license terms, summarized +in a single section below. Refer to the individual source files for the +official terms. +Some source files are under other license terms, listed in separate sections. +]]) diff --git a/ports/libdrm/vcpkg.json b/ports/libdrm/vcpkg.json new file mode 100644 index 00000000000000..49aa8c3d68b764 --- /dev/null +++ b/ports/libdrm/vcpkg.json @@ -0,0 +1,14 @@ +{ + "name": "libdrm", + "version": "2.4.121", + "description": "Userspace library for accessing the direct rendering manager (DRM)", + "homepage": "https://cgit.freedesktop.org/drm/libdrm/tree/README.rst", + "license": null, + "supports": "linux", + "dependencies": [ + { + "name": "vcpkg-tool-meson", + "host": true + } + ] +} diff --git a/versions/baseline.json b/versions/baseline.json index 904fa5270a661b..b129240dd0a9e3 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -4340,6 +4340,10 @@ "baseline": "1.1.5", "port-version": 0 }, + "libdrm": { + "baseline": "2.4.121", + "port-version": 0 + }, "libdshowcapture": { "baseline": "0.6.0", "port-version": 3 diff --git a/versions/l-/libdrm.json b/versions/l-/libdrm.json new file mode 100644 index 00000000000000..f5b7aa93b76ad7 --- /dev/null +++ b/versions/l-/libdrm.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "6eaa97c26f8276f58544d46c6149b2b44f9384e6", + "version": "2.4.121", + "port-version": 0 + } + ] +} From ed7573f3815f227967f3bb75f2661f3b05dcb945 Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Wed, 12 Jun 2024 09:04:59 +0200 Subject: [PATCH 2/8] [mesa] Fixup --- ports/mesa/portfile.cmake | 16 +++++++++++----- ports/mesa/vcpkg.json | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ports/mesa/portfile.cmake b/ports/mesa/portfile.cmake index 0d7e7cadf3c3c2..58e6e2f4813a42 100644 --- a/ports/mesa/portfile.cmake +++ b/ports/mesa/portfile.cmake @@ -9,13 +9,10 @@ vcpkg_from_gitlab( REPO mesa/mesa REF mesa-${VERSION} SHA512 202b2b20ffe7d357570a0d0bf0b53dc246b3e903738e8c8a000c5f61109ab5233d62de217444f49fd62927f8c418d929e5a2a5a800d1e39e334d50eb090e850c - FILE_DISAMBIGUATOR 1 - HEAD_REF master + HEAD_REF main ) x_vcpkg_get_python_packages(PYTHON_VERSION "3" OUT_PYTHON_VAR "PYTHON3" PACKAGES setuptools mako) -get_filename_component(PYTHON3_DIR "${PYTHON3}" DIRECTORY) -vcpkg_add_to_path(PREPEND "${PYTHON3_DIR}") vcpkg_find_acquire_program(FLEX) get_filename_component(FLEX_DIR "${FLEX}" DIRECTORY) @@ -97,6 +94,7 @@ endif() vcpkg_configure_meson( SOURCE_PATH "${SOURCE_PATH}" OPTIONS + -Degl-lib-suffix=_mesa -Dgles-lib-suffix=_mesa -Dbuild-tests=false ${MESA_OPTIONS} @@ -137,7 +135,15 @@ if(VCPKG_TARGET_IS_WINDOWS) endif() endif() -if(FEATURES STREQUAL "core") +if(VCPKG_TARGET_IS_WINDOWS and "egl" IN_LIST FEATURES) + # egl.pc is owned by port egl. Override that port to make egl.pc require egl_mesa instead of egl from angle. + file(RENAME "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/egl.pc" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/egl_mesa.pc") + if(NOT VCPKG_BUILD_TYPE) + file(RENAME "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/egl.pc" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/egl_mesa.pc") + endif() +endif() + +if(NOT EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug") endif() diff --git a/ports/mesa/vcpkg.json b/ports/mesa/vcpkg.json index 8b81ac626d7bbd..2f29d664d4566b 100644 --- a/ports/mesa/vcpkg.json +++ b/ports/mesa/vcpkg.json @@ -1,7 +1,7 @@ { "name": "mesa", "version": "24.0.7", - "port-version": 1, + "port-version": 2, "description": "Mesa - The 3D Graphics Library", "homepage": "https://www.mesa3d.org/", "license": "MIT AND BSL-1.0 AND SGI-B-2.0", From 14dcdb6c19c88a67c5e7a86f4531642f90646744 Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Thu, 11 Jan 2024 17:22:14 +0100 Subject: [PATCH 3/8] [mesa] Unroll default-features --- ports/mesa/vcpkg.json | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/ports/mesa/vcpkg.json b/ports/mesa/vcpkg.json index 2f29d664d4566b..bf74bf5a3979d1 100644 --- a/ports/mesa/vcpkg.json +++ b/ports/mesa/vcpkg.json @@ -19,30 +19,14 @@ "zstd" ], "default-features": [ - "default-features" + "gles1", + "gles2", + { + "name": "llvm", + "platform": "x64" + } ], "features": { - "default-features": { - "description": "Platform dependent default features", - "dependencies": [ - { - "name": "mesa", - "default-features": false, - "features": [ - "gles1", - "gles2" - ] - }, - { - "name": "mesa", - "default-features": false, - "features": [ - "llvm" - ], - "platform": "x64" - } - ] - }, "egl": { "description": "Build support for EGL platform", "dependencies": [ From 8afe8e265da08cf4f1b0614f649c64dc5612e60f Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Tue, 11 Jun 2024 21:55:07 +0200 Subject: [PATCH 4/8] [mesa] Restore feature opengl, revise shared_glapi --- ports/mesa/portfile.cmake | 27 ++++++++++++++++----------- ports/mesa/vcpkg.json | 30 +++++++++++++++++++++++++----- 2 files changed, 41 insertions(+), 16 deletions(-) diff --git a/ports/mesa/portfile.cmake b/ports/mesa/portfile.cmake index 58e6e2f4813a42..6994c2c922d88c 100644 --- a/ports/mesa/portfile.cmake +++ b/ports/mesa/portfile.cmake @@ -56,31 +56,36 @@ else() list(APPEND MESA_OPTIONS -Dllvm=disabled) endif() -set(use_gles OFF) +if("opengl" IN_LIST FEATURES) + list(APPEND MESA_OPTIONS -Dopengl=true) +else() + list(APPEND MESA_OPTIONS -Dopengl=false) +endif() + +set(shared_glapi auto) +# meson_build: disable_auto_if(host_machine.system() == 'windows') +if(VCPKG_TARGET_IS_WINDOWS) + set(shared_glapi disabled) +endif() if("gles1" IN_LIST FEATURES) list(APPEND MESA_OPTIONS -Dgles1=enabled) - set(use_gles ON) + set(shared_glapi enabled) else() list(APPEND MESA_OPTIONS -Dgles1=disabled) endif() if("gles2" IN_LIST FEATURES) list(APPEND MESA_OPTIONS -Dgles2=enabled) - set(use_gles ON) + set(shared_glapi enabled) else() list(APPEND MESA_OPTIONS -Dgles2=disabled) endif() - -if(use_gles) - list(APPEND MESA_OPTIONS -Dshared-glapi=enabled) # shared GLAPI required when building two or more of the following APIs - gles1 gles2 -else() - list(APPEND MESA_OPTIONS -Dshared-glapi=auto) -endif() - if("egl" IN_LIST FEATURES) list(APPEND MESA_OPTIONS -Degl=enabled) + set(shared_glapi enabled) else() list(APPEND MESA_OPTIONS -Degl=disabled) endif() +list(APPEND MESA_OPTIONS -Dshared-glapi=${shared_glapi}) if(VCPKG_TARGET_IS_WINDOWS) list(APPEND MESA_OPTIONS -Dplatforms=['windows']) @@ -124,7 +129,7 @@ if(NOT remaining) file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include") endif() -if(VCPKG_TARGET_IS_WINDOWS) +if(VCPKG_TARGET_IS_WINDOWS AND "opengl" IN_LIST FEATURES) # opengl32.lib is already installed by port opengl. # Mesa claims to provide a drop-in replacement of opengl32.dll. file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib/manual-link") diff --git a/ports/mesa/vcpkg.json b/ports/mesa/vcpkg.json index bf74bf5a3979d1..e0da497507b490 100644 --- a/ports/mesa/vcpkg.json +++ b/ports/mesa/vcpkg.json @@ -24,25 +24,33 @@ { "name": "llvm", "platform": "x64" - } + }, + "opengl" ], "features": { "egl": { "description": "Build support for EGL platform", "dependencies": [ - "egl-registry" + "egl-registry", + { + "name": "mesa", + "default-features": false, + "features": [ + "opengl" + ] + } ] }, "gles1": { "description": "Build support for OpenGL ES 1.x", "dependencies": [ - "opengl" + "opengl-registry" ] }, "gles2": { "description": "Build support for OpenGL ES 2.x and 3.x", "dependencies": [ - "opengl" + "opengl-registry" ] }, "llvm": { @@ -85,7 +93,19 @@ "offscreen": { "description": "Build with support for offscreen rendering (OSMesa)", "dependencies": [ - "opengl" + { + "name": "mesa", + "default-features": false, + "features": [ + "opengl" + ] + } + ] + }, + "opengl": { + "description": "Build support for OpenGL (all versions)", + "dependencies": [ + "opengl-registry" ] } } From c7739349a43417b98fef2fde5dea9b94a087e03a Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Thu, 11 Jan 2024 17:27:05 +0100 Subject: [PATCH 5/8] [mesa] Move const options --- ports/mesa/portfile.cmake | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/ports/mesa/portfile.cmake b/ports/mesa/portfile.cmake index 6994c2c922d88c..d823eebdc01eb6 100644 --- a/ports/mesa/portfile.cmake +++ b/ports/mesa/portfile.cmake @@ -38,12 +38,6 @@ if(WIN32) # WIN32 HOST probably has win_flex and win_bison! endif() endif() -# For features https://github.com/pal1000/mesa-dist-win should be probably studied a bit more. -list(APPEND MESA_OPTIONS -Dzstd=enabled) -list(APPEND MESA_OPTIONS -Dvalgrind=disabled) -list(APPEND MESA_OPTIONS -Dshared-llvm=disabled) -list(APPEND MESA_OPTIONS -Dcpp_rtti=true) - if("offscreen" IN_LIST FEATURES) list(APPEND MESA_OPTIONS -Dosmesa=true) else() @@ -99,9 +93,13 @@ endif() vcpkg_configure_meson( SOURCE_PATH "${SOURCE_PATH}" OPTIONS + -Dbuild-tests=false + -Dcpp_rtti=true -Degl-lib-suffix=_mesa -Dgles-lib-suffix=_mesa - -Dbuild-tests=false + -Dshared-llvm=disabled + -Dvalgrind=disabled + -Dzstd=enabled ${MESA_OPTIONS} ADDITIONAL_BINARIES python=['${PYTHON3}','-I'] From fd863be84f01892b5fc7e6662790de68860f51dc Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Fri, 22 Mar 2024 20:44:17 +0100 Subject: [PATCH 6/8] [mesa] Mitigate winflex race --- ports/mesa/portfile.cmake | 3 +- ports/mesa/winflex-race.diff | 72 ++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 ports/mesa/winflex-race.diff diff --git a/ports/mesa/portfile.cmake b/ports/mesa/portfile.cmake index d823eebdc01eb6..13cdd2d91ee5ee 100644 --- a/ports/mesa/portfile.cmake +++ b/ports/mesa/portfile.cmake @@ -9,7 +9,8 @@ vcpkg_from_gitlab( REPO mesa/mesa REF mesa-${VERSION} SHA512 202b2b20ffe7d357570a0d0bf0b53dc246b3e903738e8c8a000c5f61109ab5233d62de217444f49fd62927f8c418d929e5a2a5a800d1e39e334d50eb090e850c - HEAD_REF main + PATCHES + winflex-race.diff ) x_vcpkg_get_python_packages(PYTHON_VERSION "3" OUT_PYTHON_VAR "PYTHON3" PACKAGES setuptools mako) diff --git a/ports/mesa/winflex-race.diff b/ports/mesa/winflex-race.diff new file mode 100644 index 00000000000000..98f02ccb0db901 --- /dev/null +++ b/ports/mesa/winflex-race.diff @@ -0,0 +1,72 @@ +diff --git a/src/compiler/glsl/glcpp/meson.build b/src/compiler/glsl/glcpp/meson.build +index b3ea48a..944bc27 100644 +--- a/src/compiler/glsl/glcpp/meson.build ++++ b/src/compiler/glsl/glcpp/meson.build +@@ -42,6 +42,7 @@ glcpp_lex = custom_target( + 'glcpp-lex.c', + input : 'glcpp-lex.l', + output : 'glcpp-lex.c', ++ console: true, + command : [prog_flex, '-o', '@OUTPUT@', '@INPUT@'], + ) + +diff --git a/src/compiler/glsl/meson.build b/src/compiler/glsl/meson.build +index faded36..0179eb9 100644 +--- a/src/compiler/glsl/meson.build ++++ b/src/compiler/glsl/meson.build +@@ -53,6 +53,7 @@ glsl_lexer_cpp = custom_target( + 'glsl_lexer_cpp', + input : 'glsl_lexer.ll', + output : 'glsl_lexer.cpp', ++ console: true, + command : [prog_flex_cpp, '-o', '@OUTPUT@', '@INPUT@'], + ) + +diff --git a/src/freedreno/afuc/meson.build b/src/freedreno/afuc/meson.build +index a226d42..6102119 100644 +--- a/src/freedreno/afuc/meson.build ++++ b/src/freedreno/afuc/meson.build +@@ -35,6 +35,7 @@ afuc_lexer = custom_target( + 'lexer.c', + input: 'lexer.l', + output: 'lexer.c', ++ console: true, + command: [ + prog_flex, '-o', '@OUTPUT@', '@INPUT@' + ] +diff --git a/src/freedreno/ir3/meson.build b/src/freedreno/ir3/meson.build +index 954b0b8..cb79b62 100644 +--- a/src/freedreno/ir3/meson.build ++++ b/src/freedreno/ir3/meson.build +@@ -53,6 +53,7 @@ ir3_lexer = custom_target( + 'ir3_lexer.c', + input: 'ir3_lexer.l', + output: 'ir3_lexer.c', ++ console: true, + command: [ + prog_flex, '-o', '@OUTPUT@', '@INPUT@' + ] +diff --git a/src/intel/tools/meson.build b/src/intel/tools/meson.build +index 44fa3f1..5db6619 100644 +--- a/src/intel/tools/meson.build ++++ b/src/intel/tools/meson.build +@@ -183,6 +183,7 @@ i965_lex_yy_c = custom_target( + 'i965_lex.yy.c', + input : 'i965_lex.l', + output : 'i965_lex.yy.c', ++ console: true, + command : [prog_flex, '-o', '@OUTPUT@', '@INPUT@'] + ) + +diff --git a/src/mesa/program/meson.build b/src/mesa/program/meson.build +index 1b76d32..a43280a 100644 +--- a/src/mesa/program/meson.build ++++ b/src/mesa/program/meson.build +@@ -29,6 +29,7 @@ mesa_lex = custom_target( + 'mesa_lex', + input : 'program_lexer.l', + output : 'lex.yy.c', ++ console: true, + command : [prog_flex, '-o', '@OUTPUT@', '@INPUT@'], + ) + From a3f63680fe18a6cbc1144c122f4de655ecb3a880 Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Wed, 12 Jun 2024 06:05:54 +0200 Subject: [PATCH 7/8] [mesa] Fix python compatibility --- ports/mesa/portfile.cmake | 1 + ports/mesa/python.diff | 67 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 ports/mesa/python.diff diff --git a/ports/mesa/portfile.cmake b/ports/mesa/portfile.cmake index 13cdd2d91ee5ee..fa307f8a9a98f5 100644 --- a/ports/mesa/portfile.cmake +++ b/ports/mesa/portfile.cmake @@ -10,6 +10,7 @@ vcpkg_from_gitlab( REF mesa-${VERSION} SHA512 202b2b20ffe7d357570a0d0bf0b53dc246b3e903738e8c8a000c5f61109ab5233d62de217444f49fd62927f8c418d929e5a2a5a800d1e39e334d50eb090e850c PATCHES + python.diff winflex-race.diff ) diff --git a/ports/mesa/python.diff b/ports/mesa/python.diff new file mode 100644 index 00000000000000..e27ea607c9bdb2 --- /dev/null +++ b/ports/mesa/python.diff @@ -0,0 +1,67 @@ +diff --git a/src/nouveau/headers/class_parser.py b/src/nouveau/headers/class_parser.py +index 3adb21c..94ef624 100644 +--- a/src/nouveau/headers/class_parser.py ++++ b/src/nouveau/headers/class_parser.py +@@ -9,6 +9,16 @@ import sys + + from mako.template import Template + ++def str_removeprefix(s, prefix): ++ if s.startswith(prefix): ++ return s[len(prefix):] ++ return s ++ ++def str_removesuffix(s, suffix): ++ if s.endswith(suffix): ++ return s[:len(s)-len(suffix)] ++ return s ++ + METHOD_ARRAY_SIZES = { + 'BIND_GROUP_CONSTANT_BUFFER' : 16, + 'CALL_MME_DATA' : 256, +@@ -274,7 +284,7 @@ def parse_header(nvcl, f): + if ":" in list[2]: + state = 1 + elif teststr in list[1]: +- curmthd.field_defs[curfield][list[1].removeprefix(teststr)] = list[2] ++ curmthd.field_defs[curfield][str_removeprefix(list[1], teststr)] = list[2] + else: + state = 1 + +@@ -284,7 +294,7 @@ def parse_header(nvcl, f): + if ("0x" in list[2]): + state = 1 + else: +- field = list[1].removeprefix(teststr) ++ field = str_removeprefix(list[1], teststr) + bitfield = list[2].split(":") + curmthd.field_name_start[field] = bitfield[1] + curmthd.field_name_end[field] = bitfield[0] +@@ -305,13 +315,13 @@ def parse_header(nvcl, f): + is_array = 0 + if (':' in list[2]): + continue +- name = list[1].removeprefix(teststr) ++ name = str_removeprefix(list[1], teststr) + if name.endswith("(i)"): + is_array = 1 +- name = name.removesuffix("(i)") ++ name = str_removesuffix(name, "(i)") + if name.endswith("(j)"): + is_array = 1 +- name = name.removesuffix("(j)") ++ name = str_removesuffix(name, "(j)") + x = method() + x.name = name + x.addr = list[2] +@@ -337,8 +347,8 @@ def main(): + + clheader = os.path.basename(args.in_h) + nvcl = clheader +- nvcl = nvcl.removeprefix("cl") +- nvcl = nvcl.removesuffix(".h") ++ nvcl = str_removeprefix(nvcl, "cl") ++ nvcl = str_removesuffix(nvcl, ".h") + nvcl = nvcl.upper() + nvcl = "NV" + nvcl + From fdc74e7c7c1ed9eec85fdd495a84ab559a28d606 Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Thu, 11 Jan 2024 17:29:51 +0100 Subject: [PATCH 8/8] [mesa] Revise dependencies --- ports/mesa/dependencies.diff | 47 ++++++++++++++++++++++++++++++++++++ ports/mesa/portfile.cmake | 18 +++++++++++++- ports/mesa/vcpkg.json | 43 ++++++++++++++++++++++++++------- scripts/ci.baseline.txt | 4 --- 4 files changed, 98 insertions(+), 14 deletions(-) create mode 100644 ports/mesa/dependencies.diff diff --git a/ports/mesa/dependencies.diff b/ports/mesa/dependencies.diff new file mode 100644 index 00000000000000..256a154690a6d7 --- /dev/null +++ b/ports/mesa/dependencies.diff @@ -0,0 +1,47 @@ +diff --git a/meson.build b/meson.build +index 8963b31..524e6ec 100644 +--- a/meson.build ++++ b/meson.build +@@ -126,7 +126,7 @@ pre_args += '-DHAVE_OPENGL_ES_2=@0@'.format(with_gles2 ? '1' : '0') + + with_any_opengl = with_opengl or with_gles1 or with_gles2 + # Only build shared_glapi if at least one OpenGL API is enabled +-with_shared_glapi = with_shared_glapi and with_any_opengl ++with_shared_glapi = with_shared_glapi and (with_any_opengl or get_option('egl').enabled()) + + system_has_kms_drm = ['openbsd', 'netbsd', 'freebsd', 'gnu/kfreebsd', 'dragonfly', 'linux', 'sunos', 'android', 'managarm'].contains(host_machine.system()) + +@@ -172,7 +172,17 @@ elif gallium_drivers.contains('all') + ] + endif + ++if not get_option('llvm').enabled() and get_option('gallium-drivers').contains('auto') ++ drivers_without_llvm = [] ++ foreach driver : gallium_drivers ++ if not ['radeonsi'].contains(driver) ++ drivers_without_llvm += driver ++ endif ++ endforeach ++ gallium_drivers = drivers_without_llvm ++endif + with_gallium_radeonsi = gallium_drivers.contains('radeonsi') ++with_gallium_radeonsi = with_gallium_radeonsi and get_option('llvm').enabled() + with_gallium_r300 = gallium_drivers.contains('r300') + with_gallium_r600 = gallium_drivers.contains('r600') + with_gallium_nouveau = gallium_drivers.contains('nouveau') +@@ -237,6 +247,15 @@ elif _vulkan_drivers.contains('all') + 'nouveau-experimental'] + endif + ++if not get_option('llvm').enabled() ++ drivers_without_llvm = [] ++ foreach driver : _vulkan_drivers ++ if not ['swrast'].contains(driver) ++ drivers_without_llvm += driver ++ endif ++ endforeach ++ _vulkan_drivers = drivers_without_llvm ++endif + with_intel_vk = _vulkan_drivers.contains('intel') + with_intel_hasvk = _vulkan_drivers.contains('intel_hasvk') + with_amd_vk = _vulkan_drivers.contains('amd') diff --git a/ports/mesa/portfile.cmake b/ports/mesa/portfile.cmake index fa307f8a9a98f5..2bf81da4726bf4 100644 --- a/ports/mesa/portfile.cmake +++ b/ports/mesa/portfile.cmake @@ -10,6 +10,7 @@ vcpkg_from_gitlab( REF mesa-${VERSION} SHA512 202b2b20ffe7d357570a0d0bf0b53dc246b3e903738e8c8a000c5f61109ab5233d62de217444f49fd62927f8c418d929e5a2a5a800d1e39e334d50eb090e850c PATCHES + dependencies.diff python.diff winflex-race.diff ) @@ -83,6 +84,12 @@ else() endif() list(APPEND MESA_OPTIONS -Dshared-glapi=${shared_glapi}) +if(NOT "vulkan" IN_LIST FEATURES) # EGL feature only works on Linux + list(APPEND MESA_OPTIONS -Dvulkan-drivers=[]) +elseif(EXISTS "${CURRENT_HOST_INSTALLED_DIR}/tools/glslang") + vcpkg_list(APPEND MESA_ADDITIONAL_BINARIES "glslangValidator = '${CURRENT_HOST_INSTALLED_DIR}/tools/glslang/glslangValidator${VCPKG_HOST_EXECUTABLE_SUFFIX}'") +endif() + if(VCPKG_TARGET_IS_WINDOWS) list(APPEND MESA_OPTIONS -Dplatforms=['windows']) list(APPEND MESA_OPTIONS -Dmicrosoft-clc=disabled) @@ -90,6 +97,12 @@ if(VCPKG_TARGET_IS_WINDOWS) set(VCPKG_CXX_FLAGS "/D_CRT_DECLARE_NONSTDC_NAMES ${VCPKG_CXX_FLAGS}") set(VCPKG_C_FLAGS "/D_CRT_DECLARE_NONSTDC_NAMES ${VCPKG_C_FLAGS}") endif() +elseif(VCPKG_TARGET_IS_ANDROID) + list(APPEND MESA_OPTIONS -Dplatforms=['android']) +elseif("wayland" IN_LIST FEATURES) + list(APPEND MESA_OPTIONS -Dplatforms=['x11','wayland']) +else() + list(APPEND MESA_OPTIONS -Dplatforms=['x11']) endif() vcpkg_configure_meson( @@ -98,14 +111,17 @@ vcpkg_configure_meson( -Dbuild-tests=false -Dcpp_rtti=true -Degl-lib-suffix=_mesa + -Dexpat=disabled -Dgles-lib-suffix=_mesa - -Dshared-llvm=disabled + -Dlibunwind=disabled + -Dshared-llvm=disabled # disable autodetection - fails; llvm is ONLY_STATIC_LIBRARY -Dvalgrind=disabled -Dzstd=enabled ${MESA_OPTIONS} ADDITIONAL_BINARIES python=['${PYTHON3}','-I'] python3=['${PYTHON3}','-I'] + ${MESA_ADDITIONAL_BINARIES} ) vcpkg_install_meson() vcpkg_fixup_pkgconfig() diff --git a/ports/mesa/vcpkg.json b/ports/mesa/vcpkg.json index e0da497507b490..5f949a4b25652c 100644 --- a/ports/mesa/vcpkg.json +++ b/ports/mesa/vcpkg.json @@ -7,6 +7,10 @@ "license": "MIT AND BSL-1.0 AND SGI-B-2.0", "supports": "!(windows & arm) & !staticcrt & !uwp", "dependencies": [ + { + "name": "elfutils", + "platform": "!(android | ios | osx | windows)" + }, { "name": "vcpkg-get-python-packages", "host": true @@ -30,15 +34,9 @@ "features": { "egl": { "description": "Build support for EGL platform", + "supports": "!ios & !osx", "dependencies": [ - "egl-registry", - { - "name": "mesa", - "default-features": false, - "features": [ - "opengl" - ] - } + "egl-registry" ] }, "gles1": { @@ -54,7 +52,7 @@ ] }, "llvm": { - "description": "Build with llvmpipe", + "description": "Build with LLVM", "dependencies": [ { "name": "llvm", @@ -80,6 +78,14 @@ ], "platform": "arm64" }, + { + "name": "llvm", + "default-features": false, + "features": [ + "target-amdgpu" + ], + "platform": "!arm" + }, { "name": "llvm", "default-features": false, @@ -107,6 +113,25 @@ "dependencies": [ "opengl-registry" ] + }, + "vulkan": { + "description": "Build support for Vulkan", + "dependencies": [ + { + "name": "glslang", + "default-features": false, + "features": [ + "tools" + ], + "platform": "arm | x64 | x86" + } + ] + }, + "wayland": { + "description": "Build support for Wayland", + "dependencies": [ + "wayland-protocols" + ] } } } diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index f90d814bb03cec..fc2e0ff69e076f 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -745,10 +745,6 @@ mecab:x86-windows = skip memorymodule:arm-neon-android=fail memorymodule:arm64-android=fail memorymodule:x64-android=fail -# Missing dependent libraries. -mesa:x64-linux=fail -mesa:x64-osx=fail -mesa:arm64-osx=fail mfx-dispatch:arm-neon-android=fail mfx-dispatch:arm64-android=fail mfx-dispatch:x64-android=fail