#1 Initial import
Merged 11 months ago by mkoncek. Opened 11 months ago by mkoncek.
rpms/ mkoncek/glsl-language-server rawhide  into  rawhide

file added
+1
@@ -0,0 +1,1 @@ 

+ 1

file added
+1
@@ -0,0 +1,1 @@ 

+ /glsl-language-server-0.4.1.tar.gz

@@ -0,0 +1,103 @@ 

+ From 0136e726e5be7bcbd34b39c841bd9529bf87cf66 Mon Sep 17 00:00:00 2001

+ From: Marian Koncek <mkoncek@redhat.com>

+ Date: Fri, 19 May 2023 14:23:41 +0200

+ Subject: [PATCH 1/3] Remove support for HTTP and mongoose dependency

+ 

+ Upstream PR: https://github.com/svenstaro/glsl-language-server/pull/44

+ 

+ ---

+  src/main.cpp | 64 +---------------------------------------------------

+  1 file changed, 1 insertion(+), 63 deletions(-)

+ 

+ diff --git a/src/main.cpp b/src/main.cpp

+ index 05fe10c..ac10189 100644

+ --- a/src/main.cpp

+ +++ b/src/main.cpp

+ @@ -5,8 +5,6 @@

+  

+  #include "nlohmann/json.hpp"

+  

+ -#include "mongoose.h"

+ -

+  #include "ResourceLimits.h"

+  #include "ShaderLang.h"

+  #include "Initialize.h"

+ @@ -510,47 +508,6 @@ std::optional<std::string> handle_message(const MessageBuffer& message_buffer, A

+      return make_response(result_body);

+  }

+  

+ -void ev_handler(struct mg_connection* c, int ev, void* p) {

+ -    AppState& appstate = *static_cast<AppState*>(c->mgr->user_data);

+ -

+ -    if (ev == MG_EV_HTTP_REQUEST) {

+ -        struct http_message* hm = (struct http_message*)p;

+ -

+ -        std::string content = hm->message.p;

+ -

+ -        MessageBuffer message_buffer;

+ -        message_buffer.handle_string(content);

+ -

+ -        if (message_buffer.message_completed()) {

+ -            json body = message_buffer.body();

+ -            if (appstate.use_logfile) {

+ -                fmt::print(appstate.logfile_stream, ">>> Received message of type '{}'\n", body["method"].get<std::string>());

+ -                if (appstate.verbose) {

+ -                    fmt::print(appstate.logfile_stream, "Headers:\n");

+ -                    for (auto elem : message_buffer.headers()) {

+ -                        auto pretty_header = fmt::format("{}: {}\n", elem.first, elem.second);

+ -                        appstate.logfile_stream << pretty_header;

+ -                    }

+ -                    fmt::print(appstate.logfile_stream, "Body: \n{}\n\n", body.dump(4));

+ -                    fmt::print(appstate.logfile_stream, "Raw: \n{}\n\n", message_buffer.raw());

+ -                }

+ -            }

+ -

+ -            auto message = handle_message(message_buffer, appstate);

+ -            if (message.has_value()) {

+ -                std::string response = message.value();

+ -                mg_send_head(c, 200, response.length(), "Content-Type: text/plain");

+ -                mg_printf(c, "%.*s", static_cast<int>(response.length()), response.c_str());

+ -                if (appstate.use_logfile && appstate.verbose) {

+ -                    fmt::print(appstate.logfile_stream, "<<< Sending message: \n{}\n\n", message.value());

+ -                }

+ -            }

+ -            appstate.logfile_stream.flush();

+ -            message_buffer.clear();

+ -        }

+ -    }

+ -}

+ -

+  int main(int argc, char* argv[])

+  {

+      CLI::App app{ "GLSL Language Server" };

+ @@ -667,26 +624,7 @@ int main(int argc, char* argv[])

+          auto diagnostics = get_diagnostics(uri, contents, appstate);

+          fmt::print("diagnostics: {}\n", diagnostics.dump(4));

+      } else if (!use_stdin) {

+ -        struct mg_mgr mgr;

+ -        struct mg_connection* nc;

+ -        struct mg_bind_opts bind_opts;

+ -        std::memset(&bind_opts, 0, sizeof(bind_opts));

+ -        bind_opts.user_data = &appstate;

+ -

+ -        mg_mgr_init(&mgr, NULL);

+ -        fmt::print("Starting web server on port {}\n", port);

+ -        nc = mg_bind_opt(&mgr, std::to_string(port).c_str(), ev_handler, bind_opts);

+ -        if (nc == NULL) {

+ -            return 1;

+ -        }

+ -

+ -        // Set up HTTP server parameters

+ -        mg_set_protocol_http_websocket(nc);

+ -

+ -        while (true) {

+ -            mg_mgr_poll(&mgr, 1000);

+ -        }

+ -        mg_mgr_free(&mgr);

+ +        throw std::invalid_argument("This package was built without support for HTTP communication");

+      } else {

+          char c;

+          MessageBuffer message_buffer;

+ -- 

+ 2.40.1

+ 

@@ -0,0 +1,36 @@ 

+ From 1a52db5ff3d8fbce54b661f842851f56e3756bf2 Mon Sep 17 00:00:00 2001

+ From: Marian Koncek <mkoncek@redhat.com>

+ Date: Fri, 19 May 2023 14:24:41 +0200

+ Subject: [PATCH 2/3] Port to current CLI11

+ 

+ Upstream PR: https://github.com/svenstaro/glsl-language-server/pull/42

+ 

+ ---

+  src/main.cpp | 6 +++---

+  1 file changed, 3 insertions(+), 3 deletions(-)

+ 

+ diff --git a/src/main.cpp b/src/main.cpp

+ index ac10189..a70a074 100644

+ --- a/src/main.cpp

+ +++ b/src/main.cpp

+ @@ -528,14 +528,14 @@ int main(int argc, char* argv[])

+      app.add_option("-l,--log", logfile, "Log file");

+      app.add_option("--debug-symbols", symbols_path, "Print the list of symbols for the given file");

+      app.add_option("--debug-diagnostic", diagnostic_path, "Debug diagnostic output for the given file");

+ -    app.add_option("-p,--port", port, "Port", true)->excludes(stdin_option);

+ +    app.add_option("-p,--port", port, "Port")->excludes(stdin_option);

+      app.add_option("--target-env", client_api,

+              "Target client environment.\n"

+ -            "    [vulkan vulkan1.0 vulkan1.1 vulkan1.2 vulkan1.3 opengl opengl4.5]", true);

+ +            "    [vulkan vulkan1.0 vulkan1.1 vulkan1.2 vulkan1.3 opengl opengl4.5]");

+      app.add_option("--target-spv", spirv_version,

+              "The SPIR-V version to target.\n"

+              "Defaults to the highest possible for the target environment.\n"

+ -            "    [spv1.0 spv1.1 spv1.2 spv1.3 spv1.4 spv1.5 spv1.6]", true);

+ +            "    [spv1.0 spv1.1 spv1.2 spv1.3 spv1.4 spv1.5 spv1.6]");

+  

+      try {

+          app.parse(argc, argv);

+ -- 

+ 2.40.1

+ 

@@ -0,0 +1,110 @@ 

+ From 3267d099a1372cae650b984ac6e5627f141c9daa Mon Sep 17 00:00:00 2001

+ From: Marian Koncek <mkoncek@redhat.com>

+ Date: Fri, 19 May 2023 14:33:34 +0200

+ Subject: [PATCH 3/3] Use system libraries

+ 

+ Upstream PR: https://github.com/svenstaro/glsl-language-server/pull/43

+ 

+ ---

+  CMakeLists.txt        | 37 +++++++++++--------------------------

+  src/includer.hpp      |  2 +-

+  src/messagebuffer.hpp |  2 +-

+  3 files changed, 13 insertions(+), 28 deletions(-)

+ 

+ diff --git a/CMakeLists.txt b/CMakeLists.txt

+ index 129b1e3..4487074 100644

+ --- a/CMakeLists.txt

+ +++ b/CMakeLists.txt

+ @@ -3,32 +3,15 @@ project(glsl-language-server)

+  

+  find_package(Threads REQUIRED)

+  

+ -add_subdirectory(externals/glslang EXCLUDE_FROM_ALL)

+  include_directories(

+ -    externals/glslang/

+ -    externals/glslang/glslang/Public

+ -    externals/glslang/glslang/MachineIndependent

+ -    externals/glslang/StandAlone

+ +    /usr/include/glslang/Public

+ +    /usr/include/glslang/MachineIndependent

+  )

+  

+ -add_subdirectory(externals/fmt EXCLUDE_FROM_ALL)

+  include_directories(

+ -    externals/fmt

+ +    /usr/include/fmt

+  )

+  

+ -add_subdirectory(externals/json EXCLUDE_FROM_ALL)

+ -include_directories(

+ -    externals/json/include

+ -)

+ -

+ -add_library(mongoose externals/mongoose/mongoose.c)

+ -include_directories(

+ -    externals/mongoose

+ -)

+ -

+ -include_directories(

+ -    externals/CLI11/include)

+ -

+  set(CMAKE_CXX_STANDARD 17)

+  

+  file(GLOB SOURCES

+ @@ -38,7 +21,6 @@ file(GLOB SOURCES

+  include_directories(src)

+  add_executable(glslls

+      ${SOURCES}

+ -    externals/glslang/StandAlone/ResourceLimits.cpp

+  )

+  

+  if (CMAKE_SYSTEM_NAME MATCHES Darwin)

+ @@ -49,12 +31,15 @@ endif()

+  

+  target_link_libraries(glslls

+      ${CMAKE_THREAD_LIBS_INIT}

+ -    glslang

+ -    nlohmann_json

+ -    mongoose

+ +    libglslang.a

+      ${stdfs}

+ -    SPIRV

+ -    fmt::fmt-header-only

+ +    libSPIRV.a

+ +    libglslang-default-resource-limits.a

+ +    libMachineIndependent.a

+ +    libOSDependent.a

+ +    libOGLCompiler.a

+ +    libGenericCodeGen.a

+ +    fmt

+  )

+  

+  install(TARGETS glslls

+ diff --git a/src/includer.hpp b/src/includer.hpp

+ index 5521eb6..1795b81 100644

+ --- a/src/includer.hpp

+ +++ b/src/includer.hpp

+ @@ -1,6 +1,6 @@

+  #pragma once

+  

+ -#include "ShaderLang.h"

+ +#include <ShaderLang.h>

+  #include "workspace.hpp"

+  

+  class FileIncluder : public glslang::TShader::Includer {

+ diff --git a/src/messagebuffer.hpp b/src/messagebuffer.hpp

+ index 423056d..0394fd9 100644

+ --- a/src/messagebuffer.hpp

+ +++ b/src/messagebuffer.hpp

+ @@ -1,7 +1,7 @@

+  #ifndef MESSAGEBUFFER_H

+  #define MESSAGEBUFFER_H

+  

+ -#include "nlohmann/json.hpp"

+ +#include <nlohmann/json.hpp>

+  

+  #include <string>

+  #include <tuple>

+ -- 

+ 2.40.1

+ 

file added
+1
@@ -0,0 +1,1 @@ 

+ resultsdb-testcase: separate

file added
+9
@@ -0,0 +1,9 @@ 

+ --- !Policy

+ product_versions:

+   - fedora-*

+ decision_contexts:

+   - bodhi_update_push_testing

+   - bodhi_update_push_stable

+ rules:

+   - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build./plans/smoke.functional}

+   - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build./plans/javapackages.functional}

@@ -0,0 +1,41 @@ 

+ Name:           glsl-language-server

+ Version:        0.4.1

+ Release:        1%{?dist}

+ Summary:        Language server implementation for OpenGL Shading Language

+ License:        MIT

+ URL:            https://github.com/svenstaro/glsl-language-server

+ 

+ Source0:        %{url}/archive/%{version}/%{name}-%{version}.tar.gz

+ 

+ Patch1:         0001-Remove-support-for-HTTP-and-mongoose-dependency.patch

+ Patch2:         0002-Port-to-current-CLI11.patch

+ Patch3:         0003-Use-system-libraries.patch

+ 

+ BuildRequires:  gcc-c++

+ BuildRequires:  cmake

+ 

+ BuildRequires:  cli11-devel

+ BuildRequires:  fmt-devel

+ BuildRequires:  glslang-devel

+ BuildRequires:  json-devel

+ 

+ %description

+ Language server implementation for OpenGL Shading Language.

+ 

+ %prep

+ %autosetup -p1

+ 

+ %build

+ %cmake

+ %cmake_build

+ 

+ %install

+ %cmake_install

+ 

+ %files

+ %license LICENSE

+ %{_bindir}/glslls

+ 

+ %changelog

+ * Thu May 18 2023 Marian Koncek <mkoncek@redhat.com> - 0.4.1-1

+ - Initial build

file added
+8
@@ -0,0 +1,8 @@ 

+ summary: Basic smoke test

+ discover:

+   how: shell

+   tests:

+     - name: /smoke/print-help

+       test: glslls -h

+ execute:

+   how: tmt

file added
+1
@@ -0,0 +1,1 @@ 

+ SHA512 (glsl-language-server-0.4.1.tar.gz) = 5ee578035ceb33b8bee995872e8524b0aea1ebc98ff0dd34446ac060bcffbfa1263202e8513f75f4b2397ce739e1ea5eed1d50fcd21ef9ba1b253a878abc96ee