1
1
2
+ EXT_VERSION_MAJOR = 0
3
+ EXT_VERSION_MINOR = 1
4
+ EXT_VERSION_PATCHLEVEL = 0
5
+ EXT_VERSION = $(EXT_VERSION_MAJOR ) .$(EXT_VERSION_MINOR ) .$(EXT_VERSION_PATCHLEVEL )
2
6
3
7
PROTOBUF_ROOT =third_party/protobuf
4
8
PROTOC =$(PROTOBUF_ROOT ) /src/protoc
@@ -12,7 +16,7 @@ OBJS=$(patsubst %.cpp, %.o, $(wildcard *.cpp))
12
16
BC_FILES =$(patsubst % .o, % .bc, $(OBJS ) )
13
17
DESC_SET_FILES =$(patsubst % .proto, % .pb, $(wildcard test_protos/* .proto) )
14
18
15
- PG_CPPFLAGS =-I$(PROTOBUF_ROOT ) /src -Wno-deprecated -std=c++17 -Wno-register
19
+ PG_CPPFLAGS =-I$(PROTOBUF_ROOT ) /src -Wno-deprecated -std=c++17 -Wno-register -DEXT_VERSION_MAJOR= $( EXT_VERSION_MAJOR ) -DEXT_VERSION_MINOR= $( EXT_VERSION_MINOR ) -DEXT_VERSION_PATCHLEVEL= $( EXT_VERSION_PATCHLEVEL )
16
20
PG_CXXFLAGS =-fPIC
17
21
PG_LDFLAGS =-Wl,--whole-archive $(PROTOBUF_ROOT ) /src/.libs/libprotobuf.a -Wl,--no-whole-archive
18
22
@@ -29,7 +33,7 @@ include $(PGXS)
29
33
30
34
# Add targets to `all` and `clean`
31
35
all : sql/postgres_protobuf.sql expected/postgres_protobuf.out $(DESC_SET_FILES )
32
- clean : pb_clean
36
+ clean : postgres_protobuf_clean
33
37
34
38
protoc : $(PROTOC )
35
39
@@ -52,7 +56,8 @@ expected/postgres_protobuf.out: generate_test_cases.rb $(DESC_SET_FILES)
52
56
% .pb : % .proto $(PROTOC )
53
57
$(PROTOC ) -I test_protos --descriptor_set_out=$@ $<
54
58
55
- pb_clean :
59
+ postgres_protobuf_clean :
60
+ rm -Rf dist
56
61
rm -f $(DESC_SET_FILES )
57
62
58
63
# Work around weird error mentioned here: https://github.com/rdkit/rdkit/issues/2192
@@ -61,4 +66,16 @@ COMPILE.cxx.bc = $(CLANG) -xc++ -Wno-ignored-attributes $(BITCODE_CPPFLAGS) $(CP
61
66
$(COMPILE.cxx.bc ) -o $@ $<
62
67
$(LLVM_BINPATH ) /opt -module-summary -f $@ -o $@
63
68
64
- .PHONY : all clean protoc erb_clean pb_clean
69
+ DIST_DIR = dist/postgres-protobuf-$(EXT_VERSION )
70
+ dist : all
71
+ rm -Rf dist
72
+ mkdir -p $(DIST_DIR ) /lib $(DIST_DIR ) /extension $(DIST_DIR ) /lib/bitcode
73
+ cp postgres_protobuf.so $(DIST_DIR ) /lib/
74
+ cp postgres_protobuf.control $(DIST_DIR ) /extension/
75
+ cp postgres_protobuf--* .sql $(DIST_DIR ) /extension/
76
+ cp README.md $(DIST_DIR ) /extension/
77
+ cp * .bc $(DIST_DIR ) /lib/bitcode/
78
+ cd $(DIST_DIR ) /lib/bitcode && $(LLVM_BINPATH ) /llvm-lto -thinlto -thinlto-action=thinlink -o postgres_protobuf.index.bc * .bc
79
+ tar -C dist -cvzf dist/postgres-protobuf-$(EXT_VERSION ) .tar.gz postgres-protobuf-$(EXT_VERSION )
80
+
81
+ .PHONY : all clean protoc postgres_protobuf_clean dist
0 commit comments