On Tue, Apr 18, 2023 at 06:41:50PM -0700, Nam Nguyen wrote:
>
> Here is a diff to build shared libraries for glslang. This shared lib
> glslang will be used by emulators/flycast.
>
> I checked consumers graphics/vulkan-tools and graphics/piglit and they
> both build and run.
I tested building and running vulkan-tools only; can confirm this still
builds and runs.
> -Wl,--no-undefined is removed to avoid compiler error about missing
> functions.
Do you have some details on this? Is this an upstream error, that
that --no-undefined is wrong when building the shared library? Or is
there something that might not be compiling or linking correctly?
> ok?
Still ok thfr@ as this doesn't break anything existing and apparently
enables flycast, but it would be good to think about the above and if
upstream got this wrong, then let's think about a diff with something
like
#ifndef BUILD_BUILD_LIBS
...
#endif
>
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/graphics/glslang/Makefile,v
> retrieving revision 1.16
> diff -u -p -u -p -r1.16 Makefile
> --- Makefile 10 Mar 2023 22:28:49 -0000 1.16
> +++ Makefile 19 Apr 2023 01:34:44 -0000
> @@ -5,7 +5,9 @@ COMMENT = reference front-end for GLSL a
> GH_TAGNAME = 12.0.0
> GH_ACCOUNT = KhronosGroup
> GH_PROJECT = glslang
> -REVISION = 0
> +REVISION = 1
> +
> +SHARED_LIBS += glslang 0.0 # 0.0
>
> CATEGORIES = devel graphics
>
> @@ -24,6 +26,8 @@ MODULES = devel/cmake \
> lang/python
> TEST_DEPENDS = graphics/spirv-tools \
> shells/bash
> +
> +CONFIGURE_ARGS += -DBUILD_SHARED_LIBS=ON
>
> do-test:
> cd ${WRKSRC}/Test; exec ./runtests localResults \
> Index: patches/patch-CMakeLists_txt
> ===================================================================
> RCS file: patches/patch-CMakeLists_txt
> diff -N patches/patch-CMakeLists_txt
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-CMakeLists_txt 19 Apr 2023 01:34:44 -0000
> @@ -0,0 +1,11 @@
> +Index: CMakeLists.txt
> +--- CMakeLists.txt.orig
> ++++ CMakeLists.txt
> +@@ -195,7 +195,6 @@ elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" AND NO
> + if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
> + add_link_options("-Wl,-undefined,error")
> + else()
> +- add_link_options("-Wl,--no-undefined")
> + endif()
> + endif()
> + elseif(MSVC)
> Index: pkg/PLIST
> ===================================================================
> RCS file: /cvs/ports/graphics/glslang/pkg/PLIST,v
> retrieving revision 1.6
> diff -u -p -u -p -r1.6 PLIST
> --- pkg/PLIST 3 Mar 2023 02:38:37 -0000 1.6
> +++ pkg/PLIST 19 Apr 2023 01:34:44 -0000
> @@ -72,8 +72,6 @@ include/glslang/SPIRV/spvIR.h
> include/glslang/build_info.h
> lib/cmake/
> lib/cmake/HLSLTargets.cmake
> -lib/cmake/OGLCompilerTargets.cmake
> -lib/cmake/OSDependentTargets.cmake
> lib/cmake/SPIRVTargets.cmake
> lib/cmake/SPVRemapperTargets.cmake
> lib/cmake/glslang/
> @@ -82,15 +80,10 @@ lib/cmake/glslang/glslang-config-version
> lib/cmake/glslang/glslang-config.cmake
> lib/cmake/glslang/glslang-targets${MODCMAKE_BUILD_SUFFIX}
> lib/cmake/glslang/glslang-targets.cmake
> -lib/cmake/glslangTargets.cmake
> lib/cmake/glslangValidatorTargets.cmake
> lib/cmake/spirv-remapTargets.cmake
> -@static-lib lib/libGenericCodeGen.a
> -@static-lib lib/libHLSL.a
> -@static-lib lib/libMachineIndependent.a
> -@static-lib lib/libOGLCompiler.a
> -@static-lib lib/libOSDependent.a
> -@static-lib lib/libSPIRV.a
> -@static-lib lib/libSPVRemapper.a
> -@static-lib lib/libglslang-default-resource-limits.a
> -@static-lib lib/libglslang.a
> +@so lib/libHLSL.so
> +@so lib/libSPIRV.so
> +@so lib/libSPVRemapper.so
> +@so lib/libglslang-default-resource-limits.so
> +@lib lib/libglslang.so.${LIBglslang_VERSION}