-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkafka.make
105 lines (77 loc) · 2.64 KB
/
kafka.make
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
KAFKA_MODS := \
kafka \
ifeq ($(ARCH),x86_64)
ARCH=x64
endif
KAFKA=$(PWD)
DIST=$(KAFKA)/distribution/$(PLATFORM)/$(ARCH)/$(BITS)
BIN=$(KAFKA)/$(PLATFORM)$(ARCH)bin
ifeq ($(PLATFORM),WIN)
else ifeq ($(PLATFORM),linux)
CC=gcc
CPP=g++
KAFKAINC=~/.nuget/packages/librdkafka.redist/2.5.0/build/native/include/librdkafka
KAFKALIBS=~/.nuget/packages/librdkafka.redist/2.5.0/runtimes/linux-$(ARCH)/native/librdkafka.so
KAFKARDLICENSE=~/.nuget/packages/librdkafka.redist/2.5.0/LICENSES.txt
EXT=so
KAFKABINSRC=nuget
else ifeq ($(PLATFORM),aix)
KAFKACFLAGS=-m$(BITS)
KAFKALDFLAGS=-m$(BITS)
KAFKAEXTLIBS=-lssl -lcrypto
CC=ibm-clang_r
CPP=ibm-clang++_r
KAFKAINC=$(KAFKA)/librdkafka/src
KAFKALIBS=$(KAFKA)/librdkafka/src/librdkafka.a
EXT=so
KAFKABINSRC=build
KAFKARDLICENSE=$(KAFKA)/librdkafka/LICENSES.txt
else ifeq ($(PLATFORM),mac)
CC=cc
CPP=c++
KAFKAINC=~/.nuget/packages/librdkafka.redist/2.5.0/build/native/include/librdkafka
KAFKALIBS=~/.nuget/packages/librdkafka.redist/2.5.0/runtimes/osx-$(ARCH)/native/librdkafka.dylib
KAFKARDLICENSE=~/.nuget/packages/librdkafka.redist/2.5.0/LICENSES.txt
EXT=dylib
KAFKABINSRC=nuget
else
CC=cc
CPP=c++
endif
KAFKA_OBJS:= $(KAFKA_MODS:%=$(BIN)/%.o)
all: $(DIST)/kafka.$(EXT) $(DIST)/librdkafka.$(EXT) $(DIST)/LICENSES.librdkafka
$(BIN)/kafka.$(EXT): $(KAFKA_OBJS) $(KAFKALIBS)
$(CPP) $(KAFKALDFLAGS) -shared -o $@ $(KAFKA_OBJS) $(KAFKALIBS) $(KAFKAEXTLIBS)
$(BIN)/%.o: kafka/%.cpp $(BIN) $(KAFKAINC)
$(CPP) $(KAFKACFLAGS) -c -o $@ -DFOR$(PLATFORM) -I $(KAFKAINC) -fpic $<
$(BIN):
mkdir -p $@
$(DIST):
mkdir -p $@
$(DIST)/kafka.$(EXT): $(DIST) $(BIN)/kafka.$(EXT)
cp $(BIN)/kafka.$(EXT) $@
$(DIST)/librdkafka.$(EXT): $(KAFKALIBS)
cp $< $@
cp $(KAFKARDLICENSE) $(DIST)/LICENSES.librdkafka
$(DIST)/LICENSES.librdkafka: $(KAFKARDLICENSE)
cp $< $@
$(KAFKAINC): $(KAFKALIBS)
$(KAFKALIBS): $(KAFKA)/$(KAFKABINSRC).pseudo
$(KAFKA)/librdkafka:
git clone -b dyalog-build git@github.com:Dyalog/librdkafka $(KAFKA)/librdkafka
$(KAFKA)/build.pseudo: $(KAFKA)/librdkafka
cd $(KAFKA)/librdkafka && ./configure --prefix=/home/bhc/kafkalib --install-deps --cc=ibm-clang_r --cxx=ibm-clang++_r --CFLAGS="-D__aix" --mbits=64 --ARFLAGS=-X64 --LDFLAGS=" -lssl -lcrypto"
cd $(KAFKA)/librdkafka && make libs
touch $(KAFKA)/build.pseudo
$(KAFKA)/nuget.pseudo:
cd $(BIN) && dotnet new classlib --name kafka -o . --force
cd $(BIN) && dotnet add package librdkafka.redist --version 2.5.0
cd $(BIN) && dotnet publish
touch $(KAFKA)/nuget.pseudo
$(BIN)/librdkafka.$(EXT) : $(KAFKALIBS)
cp $< $@
clean:
rm -rf $(BIN)
rm -rf $(DIST)
rm -rf $(KAFKA)/librdkafka
rm -rf $(KAFKA)/build.pseudo $(KAFKA)/nuget.pseudo