Skip to content

Commit 0207e64

Browse files
committed
chore: fix compilation with standard PGXS target
1 parent fec3853 commit 0207e64

File tree

4 files changed

+21
-12
lines changed

4 files changed

+21
-12
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ coverage_html
1919
nginx.pid
2020
tags
2121
net_worker.pid
22+
sql/pg_net--*.sql

Makefile

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
SRC_DIR = src
2-
BUILD_DIR ?= build
32

43
# the `-Wno`s quiet C90 warnings
54
PG_CFLAGS = -std=c11 -Wextra -Wall -Werror \
@@ -23,32 +22,41 @@ REGRESS_OPTS = --use-existing --inputdir=test
2322

2423
MODULE_big = $(EXTENSION)
2524
SRC = $(wildcard $(SRC_DIR)/*.c)
25+
26+
ifdef BUILD_DIR
2627
OBJS = $(patsubst $(SRC_DIR)/%.c, $(BUILD_DIR)/%.o, $(SRC))
28+
else
29+
OBJS = $(patsubst $(SRC_DIR)/%.c, src/%.o, $(SRC)) # if no BUILD_DIR, just build on src so standard PGXS `make` works
30+
endif
2731

2832
PG_CONFIG = pg_config
2933
SHLIB_LINK = -lcurl
3034

3135
# Find <curl/curl.h> from system headers
3236
PG_CPPFLAGS := $(CPPFLAGS) -DEXTVERSION=\"$(EXTVERSION)\"
3337

34-
build: $(BUILD_DIR)/$(EXTENSION).so $(BUILD_DIR)/$(EXTENSION)--$(EXTVERSION).sql $(BUILD_DIR)/$(EXTENSION).control
38+
all: sql/$(EXTENSION)--$(EXTVERSION).sql $(EXTENSION).control
39+
40+
build: $(BUILD_DIR)/$(EXTENSION).so sql/$(EXTENSION)--$(EXTVERSION).sql $(EXTENSION).control
3541

36-
$(BUILD_DIR)/.gitignore:
42+
$(BUILD_DIR)/.gitignore: sql/$(EXTENSION)--$(EXTVERSION).sql $(EXTENSION).control
3743
mkdir -p $(BUILD_DIR)
44+
cp $(EXTENSION).control $(BUILD_DIR)
45+
cp sql/$(EXTENSION)--$(EXTVERSION).sql $(BUILD_DIR)
3846
echo "*" > $(BUILD_DIR)/.gitignore
3947

4048
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c $(BUILD_DIR)/.gitignore
4149
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
4250

43-
$(BUILD_DIR)/$(EXTENSION)--$(EXTVERSION).sql: sql/$(EXTENSION).sql
44-
cp $< $@
45-
46-
$(BUILD_DIR)/$(EXTENSION).control:
47-
sed "s/@PG_NET_VERSION@/$(EXTVERSION)/g" $(EXTENSION).control.in > $@
48-
4951
$(BUILD_DIR)/$(EXTENSION).so: $(EXTENSION).so
5052
mv $? $@
5153

54+
sql/$(EXTENSION)--$(EXTVERSION).sql: sql/$(EXTENSION).sql
55+
cp $< $@
56+
57+
$(EXTENSION).control:
58+
sed "s/@EXTVERSION@/$(EXTVERSION)/g" $(EXTENSION).control.in > $@
59+
5260
PGXS := $(shell $(PG_CONFIG) --pgxs)
5361
include $(PGXS)
5462

nix/xpg.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ let
33
dep = fetchFromGitHub {
44
owner = "steve-chavez";
55
repo = "xpg";
6-
rev = "v1.3.0";
7-
sha256 = "sha256-jDELiBbnCpRXIpod7msnhMfGcrW0pR3snDQ5T81nO0I=";
6+
rev = "v1.3.2";
7+
sha256 = "sha256-ooYqMOQD9y+/87wBd33Mvbpsx+FwEMdZoibGRM4gvBk=";
88
};
99
xpg = import dep;
1010
in

pg_net.control.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
comment = 'Async HTTP'
2-
default_version = '@PG_NET_VERSION@'
2+
default_version = '@EXTVERSION@'
33
relocatable = false

0 commit comments

Comments
 (0)