Make it work with flake.nix
This commit is contained in:
@@ -20,3 +20,5 @@ Gemfile*
|
|||||||
include/scripting/ruby_compiled.h
|
include/scripting/ruby_compiled.h
|
||||||
|
|
||||||
__old__
|
__old__
|
||||||
|
|
||||||
|
.nix-bin/
|
||||||
|
|||||||
@@ -6,3 +6,7 @@
|
|||||||
path = libs/mruby
|
path = libs/mruby
|
||||||
url = https://github.com/mruby/mruby.git
|
url = https://github.com/mruby/mruby.git
|
||||||
ignore = dirty
|
ignore = dirty
|
||||||
|
[submodule "libs/json"]
|
||||||
|
path = libs/json
|
||||||
|
url = https://github.com/nlohmann/json
|
||||||
|
ignore = dirty
|
||||||
|
|||||||
@@ -12,28 +12,35 @@ PCH_RELEASE := $(OBJ_DIR)/release/pch.h.gch
|
|||||||
GENERATED_HEADER := $(INCLUDE_DIR)/scripting/ruby_compiled.h
|
GENERATED_HEADER := $(INCLUDE_DIR)/scripting/ruby_compiled.h
|
||||||
|
|
||||||
CCACHE := ccache
|
CCACHE := ccache
|
||||||
CXX := $(CCACHE) clang++
|
|
||||||
CC := $(CCACHE) musl-clang
|
CXX ?= x86_64-unknown-linux-musl-g++
|
||||||
|
CC ?= x86_64-unknown-linux-musl-gcc
|
||||||
|
|
||||||
|
CXX := $(CCACHE) $(CXX)
|
||||||
|
CC := $(CCACHE) $(CC)
|
||||||
|
|
||||||
CFLAGS_DEBUG :=\
|
CFLAGS_DEBUG :=\
|
||||||
-std=c++20 -Wall -Wextra \
|
-std=c++20 -Wall -Wextra -static \
|
||||||
-O0 -fno-inline -gsplit-dwarf \
|
-O0 -fno-inline -gsplit-dwarf \
|
||||||
-g -fno-omit-frame-pointer \
|
-g -fno-omit-frame-pointer \
|
||||||
-Wno-unused-command-line-argument \
|
-I./include -I./libs -I./libs/mruby/include -I./libs/json/include -I./libs/mruby/build/host/include
|
||||||
-I./include -I./libs -I./libs/mruby/include
|
|
||||||
|
|
||||||
# C_SANITIZER := -fsanitize=address
|
# C_SANITIZER := -fsanitize=address
|
||||||
|
|
||||||
CFLAGS_RELEASE :=\
|
CFLAGS_RELEASE :=\
|
||||||
-static --target=x86_64-linux-musl \
|
-static \
|
||||||
-std=c++20 -O3 -march=x86-64 -mtune=generic \
|
-std=c++20 -O3 -march=x86-64 -mtune=generic -fno-rtti \
|
||||||
-fno-rtti \
|
|
||||||
-ffast-math -flto=thin \
|
-ffast-math -flto=thin \
|
||||||
-fvisibility=hidden \
|
-fvisibility=hidden \
|
||||||
-fomit-frame-pointer -DNDEBUG -s \
|
-fomit-frame-pointer -DNDEBUG -s \
|
||||||
-mllvm -vectorize-loops \
|
-mllvm -vectorize-loops \
|
||||||
-Wno-unused-command-line-argument \
|
-I./include -I./libs -I./libs/mruby/include -I./libs/json/include -I./libs/mruby/build/host/include
|
||||||
-I./include -I./libs -I./libs/mruby/include
|
|
||||||
|
PCRE_CFLAGS := $(shell pkg-config --cflags libpcre2-8)
|
||||||
|
PCRE_LIBS := $(shell pkg-config --static --libs libpcre2-8)
|
||||||
|
|
||||||
|
CFLAGS_DEBUG += $(PCRE_CFLAGS)
|
||||||
|
CFLAGS_RELEASE += $(PCRE_CFLAGS)
|
||||||
|
|
||||||
PCH_CFLAGS_DEBUG := $(CFLAGS_DEBUG) -x c++-header
|
PCH_CFLAGS_DEBUG := $(CFLAGS_DEBUG) -x c++-header
|
||||||
PCH_CFLAGS_RELEASE := $(CFLAGS_RELEASE) -x c++-header
|
PCH_CFLAGS_RELEASE := $(CFLAGS_RELEASE) -x c++-header
|
||||||
@@ -43,13 +50,15 @@ UNICODE_SRC := $(wildcard libs/unicode_width/*.c)
|
|||||||
UNICODE_OBJ_DEBUG := $(patsubst libs/unicode_width/%.c,$(OBJ_DIR)/debug/unicode_width/%.o,$(UNICODE_SRC))
|
UNICODE_OBJ_DEBUG := $(patsubst libs/unicode_width/%.c,$(OBJ_DIR)/debug/unicode_width/%.o,$(UNICODE_SRC))
|
||||||
UNICODE_OBJ_RELEASE := $(patsubst libs/unicode_width/%.c,$(OBJ_DIR)/release/unicode_width/%.o,$(UNICODE_SRC))
|
UNICODE_OBJ_RELEASE := $(patsubst libs/unicode_width/%.c,$(OBJ_DIR)/release/unicode_width/%.o,$(UNICODE_SRC))
|
||||||
|
|
||||||
LIBS_RELEASE := \
|
|
||||||
libs/libgrapheme/libgrapheme.a ./libs/mruby/build/host/lib/libmruby.a \
|
|
||||||
-Wl,-Bstatic,--gc-sections -lpcre2-8
|
|
||||||
|
|
||||||
LIBS_DEBUG := \
|
LIBS_DEBUG := \
|
||||||
libs/libgrapheme/libgrapheme.a ./libs/mruby/build/host/lib/libmruby.a \
|
libs/libgrapheme/libgrapheme.a \
|
||||||
-Wl,-Bdynamic -lpcre2-8
|
./libs/mruby/build/host/lib/libmruby.a \
|
||||||
|
$(PCRE_LIBS)
|
||||||
|
|
||||||
|
LIBS_RELEASE := \
|
||||||
|
libs/libgrapheme/libgrapheme.a \
|
||||||
|
./libs/mruby/build/host/lib/libmruby.a \
|
||||||
|
$(PCRE_LIBS)
|
||||||
|
|
||||||
SRC := $(wildcard $(SRC_DIR)/**/*.cc) $(wildcard $(SRC_DIR)/*.cc)
|
SRC := $(wildcard $(SRC_DIR)/**/*.cc) $(wildcard $(SRC_DIR)/*.cc)
|
||||||
OBJ_DEBUG := $(patsubst $(SRC_DIR)/%.cc,$(OBJ_DIR)/debug/%.o,$(SRC))
|
OBJ_DEBUG := $(patsubst $(SRC_DIR)/%.cc,$(OBJ_DIR)/debug/%.o,$(SRC))
|
||||||
|
|||||||
Generated
+27
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1783224372,
|
||||||
|
"narHash": "sha256-8i/87eeoqiGE4yOTjwSA3Eh/ziJRQEmd/unYU+K27sk=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "d407951447dcd00442e97087bf374aad70c04cea",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
{
|
||||||
|
description = "crib development environment";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs }:
|
||||||
|
let
|
||||||
|
system = "x86_64-linux";
|
||||||
|
|
||||||
|
pkgs = import nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
};
|
||||||
|
|
||||||
|
static = pkgs.pkgsStatic;
|
||||||
|
|
||||||
|
in {
|
||||||
|
devShells.${system}.default = static.mkShell {
|
||||||
|
packages = [
|
||||||
|
pkgs.ccache
|
||||||
|
pkgs.gnumake
|
||||||
|
pkgs.bear
|
||||||
|
pkgs.ruby
|
||||||
|
pkgs.pkg-config
|
||||||
|
pkgs.xxd
|
||||||
|
|
||||||
|
pkgs.gdb
|
||||||
|
|
||||||
|
pkgs.binutils
|
||||||
|
|
||||||
|
static.pcre2
|
||||||
|
];
|
||||||
|
|
||||||
|
shellHook = ''
|
||||||
|
export PKG_CONFIG_PATH="${static.pcre2.dev}/lib/pkgconfig:$PKG_CONFIG_PATH"
|
||||||
|
|
||||||
|
echo "crib static musl dev shell"
|
||||||
|
export CC=x86_64-unknown-linux-musl-gcc
|
||||||
|
export CXX=x86_64-unknown-linux-musl-g++
|
||||||
|
export AR=x86_64-unknown-linux-musl-ar
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
+1
-1
@@ -36,6 +36,7 @@ extern "C" {
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
#include <poll.h>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <shared_mutex>
|
#include <shared_mutex>
|
||||||
@@ -44,7 +45,6 @@ extern "C" {
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/poll.h>
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
|
|||||||
+767
-758
File diff suppressed because it is too large
Load Diff
@@ -124,6 +124,7 @@ extern std::unordered_map<std::string, LSP> lsps;
|
|||||||
#define ABS(x) ((x) < 0 ? -(x) : (x))
|
#define ABS(x) ((x) < 0 ? -(x) : (x))
|
||||||
#define UNUSED(x) (void)(x)
|
#define UNUSED(x) (void)(x)
|
||||||
#define USING(x) UNUSED(sizeof(x))
|
#define USING(x) UNUSED(sizeof(x))
|
||||||
|
#define CTRL(x) ((x) & 0x1f)
|
||||||
|
|
||||||
inline uint32_t HEX(const std::string &s) {
|
inline uint32_t HEX(const std::string &s) {
|
||||||
if (s.empty())
|
if (s.empty())
|
||||||
|
|||||||
+1
Submodule libs/json added at 3b0dd69928
Vendored
+1
-1
Submodule libs/mruby updated: 7d08c6246d...88b93f66c4
@@ -191,6 +191,15 @@ BarLine bar_contents(uint8_t mode, uint32_t width, std::string foldername,
|
|||||||
mrb_value mod_val = mrb_obj_value(C_module);
|
mrb_value mod_val = mrb_obj_value(C_module);
|
||||||
mrb_value block = mrb_funcall(mrb, mod_val, "b_bar", 0);
|
mrb_value block = mrb_funcall(mrb, mod_val, "b_bar", 0);
|
||||||
mrb_value val_line = mrb_funcall(mrb, block, "call", 1, info);
|
mrb_value val_line = mrb_funcall(mrb, block, "call", 1, info);
|
||||||
|
if (mrb_array_p(val_line) && RARRAY_LEN(val_line) == 1) {
|
||||||
|
val_line = mrb_ary_ref(mrb, val_line, 0);
|
||||||
|
}
|
||||||
|
if (!mrb_hash_p(val_line)) {
|
||||||
|
mrb_value inspected = mrb_funcall(mrb, val_line, "inspect", 0);
|
||||||
|
printf("bar returned: %s\n", RSTRING_PTR(inspected));
|
||||||
|
fprintf(stderr, "bar returned: %s\n", mrb_obj_classname(mrb, val_line));
|
||||||
|
abort();
|
||||||
|
}
|
||||||
if (mrb->exc) {
|
if (mrb->exc) {
|
||||||
end_screen();
|
end_screen();
|
||||||
fputs("Error when executing Ruby code:\n", stderr);
|
fputs("Error when executing Ruby code:\n", stderr);
|
||||||
@@ -200,6 +209,11 @@ BarLine bar_contents(uint8_t mode, uint32_t width, std::string foldername,
|
|||||||
}
|
}
|
||||||
mrb_value text_val = mrb_hash_get(
|
mrb_value text_val = mrb_hash_get(
|
||||||
mrb, val_line, mrb_symbol_value(mrb_intern_cstr(mrb, "text")));
|
mrb, val_line, mrb_symbol_value(mrb_intern_cstr(mrb, "text")));
|
||||||
|
if (!mrb_string_p(text_val)) {
|
||||||
|
fprintf(stderr, "text is not a string: %s\n",
|
||||||
|
mrb_obj_classname(mrb, text_val));
|
||||||
|
abort();
|
||||||
|
}
|
||||||
const char *ptr = RSTRING_PTR(text_val);
|
const char *ptr = RSTRING_PTR(text_val);
|
||||||
mrb_int len = RSTRING_LEN(text_val);
|
mrb_int len = RSTRING_LEN(text_val);
|
||||||
bar_line.line = std::string(ptr, len);
|
bar_line.line = std::string(ptr, len);
|
||||||
|
|||||||
Regular → Executable
Reference in New Issue
Block a user