2021-01-12 08:12:01 +08:00
# Build-Depends: From X Window PR: zstd, drm (!windows), elfutils (!windows), wayland (!windows), wayland-protocols (!windows), xdamage, xshmfence (!windows), x11, xcb, xfixes, xext, xxf86vm, xrandr, xv, xvmc (!windows), egl-registry, opengl-registry, tool-meson
# Required LLVM modules: LLVM (modules: bitwriter, core, coroutines, engine, executionengine, instcombine, mcdisassembler, mcjit, scalaropts, transformutils) found: YES
2021-06-30 07:08:28 +08:00
# Patches are from https://github.com/pal1000/mesa-dist-win/tree/master/patches
set ( PATCHES
2022-05-17 02:41:53 +08:00
# Fix symbols exporting for MinGW GCC x86
d e f - f i x e s . p a t c h
# Fix MinGW clang build
c l a n g . p a t c h
# Clover build on Windows
c l o v e r . p a t c h
2021-06-30 07:08:28 +08:00
)
2021-01-12 08:12:01 +08:00
vcpkg_check_linkage ( ONLY_DYNAMIC_CRT )
2021-06-30 07:08:28 +08:00
if ( VCPKG_TARGET_IS_WINDOWS )
2021-01-12 08:12:01 +08:00
set ( VCPKG_POLICY_DLLS_IN_STATIC_LIBRARY enabled ) # some parts of this port can only build as a shared library.
endif ( )
vcpkg_from_gitlab (
G I T L A B _ U R L h t t p s : / / g i t l a b . f r e e d e s k t o p . o r g
O U T _ S O U R C E _ P A T H S O U R C E _ P A T H
R E P O m e s a / m e s a
2022-05-17 02:41:53 +08:00
R E F m e s a - 2 2 . 0 . 2
S H A 5 1 2 1 1 3 9 b a e 1 f a 9 f 9 b 4 9 7 2 7 c 5 a a d d a d 9 b 2 9 0 8 c 7 6 4 3 d 7 c 6 c 4 3 5 5 4 4 e 8 3 2 2 c 8 4 d 1 7 c 0 1 2 f 0 4 a a 7 3 8 7 6 b e f 8 c a b 9 b 5 1 7 e 3 6 9 5 7 e b 2 a 6 7 8 b 3 0 0 1 d a 2 d 6 9 a 3 2 4 9 7 e f 4 5 6 9 f 6 1 7 2 e
2022-01-19 07:45:42 +08:00
F I L E _ D I S A M B I G U A T O R 1
2021-06-30 07:08:28 +08:00
H E A D _ R E F m a s t e r
P A T C H E S $ { P A T C H E S }
2021-01-12 08:12:01 +08:00
)
2022-04-15 02:08:23 +08:00
x_vcpkg_get_python_packages ( PYTHON_VERSION "3" OUT_PYTHON_VAR "PYTHON3" PACKAGES setuptools mako )
2021-01-12 08:12:01 +08:00
vcpkg_find_acquire_program ( FLEX )
get_filename_component ( FLEX_DIR "${FLEX}" DIRECTORY )
vcpkg_add_to_path ( PREPEND "${FLEX_DIR}" )
vcpkg_find_acquire_program ( BISON )
get_filename_component ( BISON_DIR "${BISON}" DIRECTORY )
vcpkg_add_to_path ( PREPEND "${BISON_DIR}" )
if ( WIN32 ) # WIN32 HOST probably has win_flex and win_bison!
if ( NOT EXISTS "${FLEX_DIR}/flex${VCPKG_HOST_EXECUTABLE_SUFFIX}" )
if ( FLEX_DIR MATCHES "${DOWNLOADS}" )
file ( CREATE_LINK "${FLEX}" "${FLEX_DIR}/flex${VCPKG_HOST_EXECUTABLE_SUFFIX}" )
else ( )
message ( FATAL_ERROR "${PORT} requires flex being named flex on windows and not win_flex!\n(Can be solved by creating a simple link from win_flex to flex)" )
endif ( )
endif ( )
if ( NOT EXISTS "${BISON_DIR}/BISON${VCPKG_HOST_EXECUTABLE_SUFFIX}" )
if ( BISON_DIR MATCHES "${DOWNLOADS}" )
file ( CREATE_LINK "${BISON}" "${BISON_DIR}/bison${VCPKG_HOST_EXECUTABLE_SUFFIX}" )
else ( )
message ( FATAL_ERROR "${PORT} requires bison being named bison on windows and not win_bison!\n(Can be solved by creating a simple link from win_bison to bison)" )
endif ( )
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 -Dshared-llvm=auto )
list ( APPEND MESA_OPTIONS -Dlibunwind=disabled )
list ( APPEND MESA_OPTIONS -Dlmsensors=disabled )
list ( APPEND MESA_OPTIONS -Dvalgrind=disabled )
list ( APPEND MESA_OPTIONS -Dglvnd=false )
list ( APPEND MESA_OPTIONS -Dglx=disabled )
list ( APPEND MESA_OPTIONS -Dgbm=disabled )
2021-06-30 07:08:28 +08:00
list ( APPEND MESA_OPTIONS -Dosmesa=true )
2021-01-12 08:12:01 +08:00
if ( "llvm" IN_LIST FEATURES )
list ( APPEND MESA_OPTIONS -Dllvm=enabled )
else ( )
list ( APPEND MESA_OPTIONS -Dllvm=disabled )
endif ( )
if ( "gles1" IN_LIST FEATURES )
list ( APPEND MESA_OPTIONS -Dgles1=enabled )
else ( )
list ( APPEND MESA_OPTIONS -Dgles1=disabled )
endif ( )
if ( "gles2" IN_LIST FEATURES )
list ( APPEND MESA_OPTIONS -Dgles2=enabled )
else ( )
list ( APPEND MESA_OPTIONS -Dgles2=disabled )
endif ( )
if ( "opengl" IN_LIST FEATURES )
list ( APPEND MESA_OPTIONS -Dopengl=true )
else ( )
list ( APPEND MESA_OPTIONS -Dopengl=false )
endif ( )
if ( "egl" IN_LIST FEATURES ) # EGL feature only works on Linux
list ( APPEND MESA_OPTIONS -Degl=enabled )
else ( )
list ( APPEND MESA_OPTIONS -Degl=disabled )
endif ( )
list ( APPEND MESA_OPTIONS -Dshared-glapi=enabled ) #shared GLAPI required when building two or more of the following APIs - opengl, gles1 gles2
if ( VCPKG_TARGET_IS_WINDOWS )
list ( APPEND MESA_OPTIONS -Dplatforms=['windows'] )
2021-06-30 07:08:28 +08:00
list ( APPEND MESA_OPTIONS -Dmicrosoft-clc=disabled )
2022-05-17 02:41:53 +08:00
if ( NOT VCPKG_TARGET_IS_MINGW )
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 ( )
2021-01-12 08:12:01 +08:00
endif ( )
2022-05-17 02:41:53 +08:00
2021-01-12 08:12:01 +08:00
vcpkg_configure_meson (
S O U R C E _ P A T H " $ { S O U R C E _ P A T H } "
O P T I O N S
2021-01-23 02:27:34 +08:00
- D g l e s - l i b - s u f f i x = _ m e s a
2021-01-12 08:12:01 +08:00
#-D egl-lib-suffix=_mesa
- D b u i l d - t e s t s = f a l s e
$ { M E S A _ O P T I O N S }
)
vcpkg_install_meson ( )
vcpkg_fixup_pkgconfig ( )
2022-01-19 07:45:42 +08:00
file ( REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" )
file ( REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share" )
2021-01-12 08:12:01 +08:00
#installed by egl-registry
2022-01-19 07:45:42 +08:00
file ( REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/KHR" )
file ( REMOVE "${CURRENT_PACKAGES_DIR}/include/EGL/egl.h" )
file ( REMOVE "${CURRENT_PACKAGES_DIR}/include/EGL/eglext.h" )
file ( REMOVE "${CURRENT_PACKAGES_DIR}/include/EGL/eglplatform.h" )
2021-01-12 08:12:01 +08:00
#installed by opengl-registry
set ( _double_files include/GL/glcorearb.h include/GL/glext.h include/GL/glxext.h
i n c l u d e / G L E S / e g l . h i n c l u d e / G L E S / g l . h i n c l u d e / G L E S / g l e x t . h i n c l u d e / G L E S / g l p l a t f o r m . h
i n c l u d e / G L E S 2 / g l 2 . h i n c l u d e / G L E S 2 / g l 2 e x t . h i n c l u d e / G L E S 2 / g l 2 p l a t f o r m . h
i n c l u d e / G L E S 3 / g l 3 . h i n c l u d e / G L E S 3 / g l 3 1 . h i n c l u d e / G L E S 3 / g l 3 2 . h i n c l u d e / G L E S 3 / g l 3 p l a t f o r m . h )
list ( TRANSFORM _double_files PREPEND "${CURRENT_PACKAGES_DIR}/" )
file ( REMOVE ${ _double_files } )
2022-01-19 07:45:42 +08:00
file ( REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/GLES" )
file ( REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/GLES2" )
2021-12-21 00:21:15 +08:00
# Handle copyright
2021-01-12 08:12:01 +08:00
file ( MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/${PORT}" )
file ( TOUCH "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" )