Merge pull request #133809 from SuperSandro2000/luaformat
This commit is contained in:
commit
1509e3cbaa
4 changed files with 125 additions and 0 deletions
22
pkgs/development/libraries/libargs/default.nix
Normal file
22
pkgs/development/libraries/libargs/default.nix
Normal file
|
@ -0,0 +1,22 @@
|
|||
{ lib, stdenv, fetchFromGitHub, cmake }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "args";
|
||||
version = "6.2.6";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "Taywee";
|
||||
repo = pname;
|
||||
rev = version;
|
||||
sha256 = "sha256-g5OXuZNi5bkWuSg7SNmhA6vyHUOFU8suYkH8nGx6tvg=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
|
||||
meta = with lib; {
|
||||
description = "A simple header-only C++ argument parser library";
|
||||
homepage = "https://github.com/Taywee/args";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ SuperSandro2000 ];
|
||||
};
|
||||
}
|
32
pkgs/tools/misc/lua-format/default.nix
Normal file
32
pkgs/tools/misc/lua-format/default.nix
Normal file
|
@ -0,0 +1,32 @@
|
|||
{ lib, stdenv, fetchFromGitHub, substituteAll, antlr4, libargs, catch2, cmake, libyamlcpp }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "lua-format";
|
||||
version = "1.3.6";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "Koihik";
|
||||
repo = "LuaFormatter";
|
||||
rev = version;
|
||||
sha256 = "14l1f9hrp6m7z3cm5yl0njba6gfixzdirxjl8nihp9val0685vm0";
|
||||
};
|
||||
|
||||
patches = [
|
||||
(substituteAll {
|
||||
src = ./fix-lib-paths.patch;
|
||||
antlr4RuntimeCpp = antlr4.runtime.cpp.dev;
|
||||
inherit libargs catch2 libyamlcpp;
|
||||
})
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
|
||||
buildInputs = [ antlr4.runtime.cpp libyamlcpp ];
|
||||
|
||||
meta = with lib; {
|
||||
description = "Code formatter for Lua";
|
||||
homepage = "https://github.com/Koihik/LuaFormatter";
|
||||
license = licenses.asl20;
|
||||
maintainers = with maintainers; [ SuperSandro2000 ];
|
||||
};
|
||||
}
|
67
pkgs/tools/misc/lua-format/fix-lib-paths.patch
Normal file
67
pkgs/tools/misc/lua-format/fix-lib-paths.patch
Normal file
|
@ -0,0 +1,67 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 4a21b94..0ac7911 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -67,10 +67,10 @@ endif()
|
||||
|
||||
include_directories(
|
||||
${PROJECT_SOURCE_DIR}/generated/
|
||||
- ${PROJECT_SOURCE_DIR}/third_party/
|
||||
- ${PROJECT_SOURCE_DIR}/third_party/Catch2/single_include
|
||||
- ${PROJECT_SOURCE_DIR}/third_party/yaml-cpp/include
|
||||
- ${PROJECT_SOURCE_DIR}/third_party/antlr4/runtime/Cpp/runtime/src
|
||||
+ @libargs@/include
|
||||
+ @catch2@/include
|
||||
+ @libyamlcpp@/include
|
||||
+ @antlr4RuntimeCpp@/include/antlr4-runtime
|
||||
${PROJECT_SOURCE_DIR}/src/
|
||||
)
|
||||
|
||||
@@ -92,9 +92,6 @@ file(GLOB_RECURSE yaml-cpp-src
|
||||
${PROJECT_SOURCE_DIR}/third_party/yaml-cpp/src/*.cpp
|
||||
)
|
||||
|
||||
-add_library (antlr4-cpp-runtime ${antlr4-cpp-src})
|
||||
-add_library (yaml-cpp ${yaml-cpp-src})
|
||||
-
|
||||
add_executable(lua-format ${src_dir} src/main.cpp)
|
||||
|
||||
if(WIN32)
|
||||
@@ -104,7 +101,7 @@ endif()
|
||||
|
||||
set_target_properties(lua-format PROPERTIES LINKER_LANGUAGE CXX)
|
||||
|
||||
-target_link_libraries(lua-format yaml-cpp antlr4-cpp-runtime ${extra-libs})
|
||||
+target_link_libraries(lua-format yaml-cpp antlr4-runtime ${extra-libs})
|
||||
|
||||
install(TARGETS lua-format
|
||||
RUNTIME DESTINATION bin
|
||||
@@ -135,7 +132,7 @@ if(BUILD_TESTS)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(lua-format-test PUBLIC PROJECT_PATH="${PROJECT_SOURCE_DIR}")
|
||||
- target_link_libraries(lua-format-test yaml-cpp antlr4-cpp-runtime ${extra-libs})
|
||||
+ target_link_libraries(lua-format-test yaml-cpp antlr4-runtime ${extra-libs})
|
||||
|
||||
add_test(NAME args COMMAND lua-format-test [args])
|
||||
add_test(NAME config COMMAND lua-format-test [config])
|
||||
diff --git a/src/main.cpp b/src/main.cpp
|
||||
index 38962a2..332aad6 100644
|
||||
--- a/src/main.cpp
|
||||
+++ b/src/main.cpp
|
||||
@@ -1,4 +1,4 @@
|
||||
-#include <args/args.hxx>
|
||||
+#include <args.hxx>
|
||||
#include <cstdlib>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
diff --git a/test/test_args.cpp b/test/test_args.cpp
|
||||
index 69a5746..b988d00 100644
|
||||
--- a/test/test_args.cpp
|
||||
+++ b/test/test_args.cpp
|
||||
@@ -1,4 +1,4 @@
|
||||
-#include <args/args.hxx>
|
||||
+#include <args.hxx>
|
||||
#include <catch2/catch.hpp>
|
||||
#include <iostream>
|
||||
#include <tuple>
|
|
@ -970,6 +970,8 @@ with pkgs;
|
|||
|
||||
logseq = callPackage ../applications/misc/logseq { };
|
||||
|
||||
lua-format = callPackage ../tools/misc/lua-format { };
|
||||
|
||||
lxterminal = callPackage ../applications/terminal-emulators/lxterminal { };
|
||||
|
||||
microcom = callPackage ../applications/terminal-emulators/microcom { };
|
||||
|
@ -16346,6 +16348,8 @@ with pkgs;
|
|||
libayatana-appindicator-gtk3 = libayatana-appindicator.override { gtkVersion = "3"; };
|
||||
libayatana-appindicator = callPackage ../development/libraries/libayatana-appindicator { };
|
||||
|
||||
libargs = callPackage ../development/libraries/libargs { };
|
||||
|
||||
libarchive = callPackage ../development/libraries/libarchive {
|
||||
autoreconfHook = buildPackages.autoreconfHook269;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue