Skip to content

Commit 0aa7208

Browse files
committed
Make target to generate tarball
1 parent 3b542fe commit 0aa7208

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
*.o
33
*.so
44
*.bc
5+
/dist
56
/test_protos/*_descriptor_set.pb
67
/third_party
78

Makefile

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11

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)
26

37
PROTOBUF_ROOT=third_party/protobuf
48
PROTOC=$(PROTOBUF_ROOT)/src/protoc
@@ -12,7 +16,7 @@ OBJS=$(patsubst %.cpp, %.o, $(wildcard *.cpp))
1216
BC_FILES=$(patsubst %.o, %.bc, $(OBJS))
1317
DESC_SET_FILES=$(patsubst %.proto, %.pb, $(wildcard test_protos/*.proto))
1418

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)
1620
PG_CXXFLAGS=-fPIC
1721
PG_LDFLAGS=-Wl,--whole-archive $(PROTOBUF_ROOT)/src/.libs/libprotobuf.a -Wl,--no-whole-archive
1822

@@ -29,7 +33,7 @@ include $(PGXS)
2933

3034
# Add targets to `all` and `clean`
3135
all: sql/postgres_protobuf.sql expected/postgres_protobuf.out $(DESC_SET_FILES)
32-
clean: pb_clean
36+
clean: postgres_protobuf_clean
3337

3438
protoc: $(PROTOC)
3539

@@ -52,7 +56,8 @@ expected/postgres_protobuf.out: generate_test_cases.rb $(DESC_SET_FILES)
5256
%.pb: %.proto $(PROTOC)
5357
$(PROTOC) -I test_protos --descriptor_set_out=$@ $<
5458

55-
pb_clean:
59+
postgres_protobuf_clean:
60+
rm -Rf dist
5661
rm -f $(DESC_SET_FILES)
5762

5863
# 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
6166
$(COMPILE.cxx.bc) -o $@ $<
6267
$(LLVM_BINPATH)/opt -module-summary -f $@ -o $@
6368

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

postgres_protobuf.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ extern "C" {
1919

2020
namespace postgres_protobuf {
2121
namespace version {
22-
const int64_t majorVersion = 0;
23-
const int64_t minorVersion = 1;
24-
const int64_t patchlevel = 0;
22+
const int64_t majorVersion = EXT_VERSION_MAJOR;
23+
const int64_t minorVersion = EXT_VERSION_MINOR;
24+
const int64_t patchlevel = EXT_VERSION_PATCHLEVEL;
2525
constexpr int64_t numericVersion =
2626
majorVersion * 10000 + minorVersion * 100 + patchlevel;
2727
} // namespace version

0 commit comments

Comments
 (0)