diff --git a/graphics/glslang/Portfile b/graphics/glslang/Portfile index b72c822b7d145..ef0056f5cba56 100644 --- a/graphics/glslang/Portfile +++ b/graphics/glslang/Portfile @@ -6,7 +6,7 @@ PortGroup cmake 1.1 PortGroup legacysupport 1.1 github.setup KhronosGroup glslang 13.0.0 -revision 2 +revision 3 categories graphics devel license {BSD Permissive} @@ -36,6 +36,15 @@ compiler.cxx_standard 2017 legacysupport.newest_darwin_requires_legacy 18 legacysupport.use_mp_libcxx yes +# Generate a pkg-config file, so that software projects that use +# pkg-config to locate external dependencies (e.g., Godot 4.x) are able +# to find and link against glslang. +# +# This patch has also been submitted upstream, and when it gets added +# to the glslang codebase, our patchfile can be deleted: +# https://github.com/KhronosGroup/glslang/pull/3371 +patchfiles-append create-pkgconfig-file.diff + depends_build-append port:python${py_ver_nodot} configure.python ${prefix}/bin/python${py_ver} configure.args-append -DPYTHON_EXECUTABLE:FILEPATH=${configure.python} diff --git a/graphics/glslang/files/create-pkgconfig-file.diff b/graphics/glslang/files/create-pkgconfig-file.diff new file mode 100644 index 0000000000000..1979079a910e6 --- /dev/null +++ b/graphics/glslang/files/create-pkgconfig-file.diff @@ -0,0 +1,37 @@ +--- CMakeLists.txt.orig 2023-08-23 19:24:25.000000000 -0400 ++++ CMakeLists.txt 2023-10-13 18:07:29.000000000 -0400 +@@ -361,4 +361,34 @@ + DESTINATION + "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" + ) ++ ++ # Generate a pkg-config file, so that software projects which use ++ # pkg-config to locate dependencies can find glslang ++ ++ # This template is filled-in by CMake's `configure_file(... @ONLY)`. ++ # The `@...@` are substituted by CMake's configure_file(), either ++ # from variables set in CMakeLists.txt or by CMake itself. ++ # (Based on: https://www.scivision.dev/cmake-generate-pkg-config/) ++ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc.in" [=[ ++prefix="@CMAKE_INSTALL_PREFIX@" ++exec_prefix="${prefix}" ++libdir="${prefix}/lib" ++includedir="${prefix}/include" ++ ++Name: @PROJECT_NAME@ ++Description: official reference compiler front end for the OpenGL ES and OpenGL shading languages ++Version: @PROJECT_VERSION@ ++Cflags: -I"${includedir}" ++Libs: -L"${libdir}" -l@PROJECT_NAME@ ++ ]=]) ++ configure_file( ++ "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc.in" ++ "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc" ++ @ONLY) ++ install( ++ FILES ++ "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc" ++ DESTINATION ++ "${CMAKE_INSTALL_LIBDIR}/pkgconfig" ++ ) + endif()