refactor: hectic C: perfavor
This commit is contained in:
21
flake.nix
21
flake.nix
@@ -155,7 +155,7 @@
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
pure-c = pkgs.mkShell {
|
pure-c = pkgs.mkShell {
|
||||||
buildInputs = (with pkgs; [ inotify-tools ]) ++ (with self.packages.${system}; [ nvim-pager ]) ++ (with pkgs-unstable; [ gdb gcc ]);
|
buildInputs = (with pkgs; [ inotify-tools ]) ++ (with self.packages.${system}; [ nvim-pager ]) ++ (with pkgs-unstable; [ gdb gcc binutils ]);
|
||||||
PAGER = "${self.packages.${system}.nvim-pager}/bin/pager";
|
PAGER = "${self.packages.${system}.nvim-pager}/bin/pager";
|
||||||
|
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
@@ -429,16 +429,29 @@
|
|||||||
} {
|
} {
|
||||||
pname = "http";
|
pname = "http";
|
||||||
inherit version;
|
inherit version;
|
||||||
src = prev.fetchFromGitHub { owner = "pramsey"; repo = "pgsql-http"; rev = "v${version}"; hash = "sha256-C8eqi0q1dnshUAZjIsZFwa5FTYc7vmATF3vv2CReWPM="; }; nativeBuildInputs = with prev; [pkg-config curl]; };
|
src = prev.fetchFromGitHub {
|
||||||
|
owner = "pramsey";
|
||||||
|
repo = "pgsql-http";
|
||||||
|
rev = "v${version}";
|
||||||
|
hash = "sha256-C8eqi0q1dnshUAZjIsZFwa5FTYc7vmATF3vv2CReWPM=";
|
||||||
|
};
|
||||||
|
nativeBuildInputs = with prev; [pkg-config curl];
|
||||||
|
};
|
||||||
buildHelExt = versionSuffix: let
|
buildHelExt = versionSuffix: let
|
||||||
postgresql = prev."postgresql_${versionSuffix}";
|
postgresql = prev."postgresql_${versionSuffix}";
|
||||||
|
c-hectic = self.packages.${prev.system}.c-hectic;
|
||||||
in buildPostgresqlExtension {
|
in buildPostgresqlExtension {
|
||||||
inherit postgresql;
|
inherit postgresql;
|
||||||
} {
|
} {
|
||||||
pname = "postgrect";
|
pname = "hel";
|
||||||
version = "0.1";
|
version = "0.1";
|
||||||
src = ./package/c/hel;
|
src = ./package/c/hel;
|
||||||
nativeBuildInputs = (with prev; [pkg-config]) ++ [ self.packages.${prev.system}.c-hectic ];
|
nativeBuildInputs = (with prev; [pkg-config]) ++ [ c-hectic ];
|
||||||
|
dontShrinkRPath = true;
|
||||||
|
postFixup = ''
|
||||||
|
echo ">>> postFixup running..."
|
||||||
|
${prev.patchelf}/bin/patchelf --set-rpath ${c-hectic}/lib $out/lib/hel.so
|
||||||
|
'';
|
||||||
preInstall = ''mkdir $out'';
|
preInstall = ''mkdir $out'';
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ stdenv.mkDerivation {
|
|||||||
cp target/libhectic.a $out/lib/
|
cp target/libhectic.a $out/lib/
|
||||||
cp target/hectic.so $out/lib/
|
cp target/hectic.so $out/lib/
|
||||||
cp hectic.h $out/include/
|
cp hectic.h $out/include/
|
||||||
|
ln $out/lib/hectic.so $out/lib/libhectic.so
|
||||||
|
|
||||||
# Create hectic-config script
|
# Create hectic-config script
|
||||||
cat > $out/bin/hectic-config <<EOF
|
cat > $out/bin/hectic-config <<EOF
|
||||||
@@ -31,6 +32,7 @@ stdenv.mkDerivation {
|
|||||||
echo "Usage: hectic-config [--cflags] [--libs] [--static]"
|
echo "Usage: hectic-config [--cflags] [--libs] [--static]"
|
||||||
echo " --cflags Print the compiler flags"
|
echo " --cflags Print the compiler flags"
|
||||||
echo " --libs Print the linker flags (dynamic library by default)"
|
echo " --libs Print the linker flags (dynamic library by default)"
|
||||||
|
echo " --libdir Print the lib directory"
|
||||||
echo " --static When used with --libs, use static linking"
|
echo " --static When used with --libs, use static linking"
|
||||||
echo " --help Display this help message"
|
echo " --help Display this help message"
|
||||||
exit \$1
|
exit \$1
|
||||||
@@ -53,6 +55,9 @@ stdenv.mkDerivation {
|
|||||||
--cflags)
|
--cflags)
|
||||||
echo "-I$out/include"
|
echo "-I$out/include"
|
||||||
;;
|
;;
|
||||||
|
--libdir)
|
||||||
|
echo "-I$out/lib"
|
||||||
|
;;
|
||||||
--libs)
|
--libs)
|
||||||
if [ \$static -eq 1 ]; then
|
if [ \$static -eq 1 ]; then
|
||||||
echo "-L$out/lib -static -lhectic"
|
echo "-L$out/lib -static -lhectic"
|
||||||
|
|||||||
@@ -4,14 +4,15 @@ EXTENSION = hel
|
|||||||
|
|
||||||
DATA = $(wildcard *.sql)
|
DATA = $(wildcard *.sql)
|
||||||
|
|
||||||
|
HECTIC_CONFIG = hectic-config
|
||||||
PG_CONFIG = pg_config
|
PG_CONFIG = pg_config
|
||||||
|
|
||||||
HECTIC_CONFIG = hectic-config
|
PG_CFLAGS += $(shell $(HECTIC_CONFIG) --cflags)
|
||||||
|
PG_LDFLAGS += -Wl,-rpath,$(shell $(HECTIC_CONFIG) --libdir)
|
||||||
|
SHLIB_LINK += $(shell $(HECTIC_CONFIG) --libs)
|
||||||
|
|
||||||
CFLAGS += $(shell $(HECTIC_CONFIG) --cflags)
|
PG_CFLAGS += -fsanitize=address
|
||||||
LIBS += $(shell $(HECTIC_CONFIG) --libs)
|
PG_LDFLAGS += -fsanitize=address
|
||||||
|
|
||||||
SHLIB_LINK := $(LIBS)
|
|
||||||
|
|
||||||
PGXS := $(shell $(PG_CONFIG) --pgxs)
|
PGXS := $(shell $(PG_CONFIG) --pgxs)
|
||||||
include $(PGXS)
|
include $(PGXS)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#include <fmgr.h>
|
#include <fmgr.h>
|
||||||
#include <utils/builtins.h>
|
#include <utils/builtins.h>
|
||||||
#include <utils/json.h>
|
#include <utils/json.h>
|
||||||
#include <hectic.h>
|
#include "hectic.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef PG_MODULE_MAGIC
|
#ifdef PG_MODULE_MAGIC
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user