Skip to content

Commit

Permalink
Improve build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
silviucpp committed Feb 12, 2022
1 parent fdce9f5 commit a17afb9
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
### Changelog:

#### v2.0.8

- Improve build scripts

#### v2.0.7

- Fix compilation error under elixir 1.13
Expand Down
2 changes: 1 addition & 1 deletion README.MD
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# erlkaf
[![Build Status](https://travis-ci.com/silviucpp/erlkaf.svg?branch=master)](https://travis-ci.com/github/silviucpp/erlkaf)
![GitHub](https://img.shields.io/github/license/silviucpp/erlkaf)
[![GitHub](https://img.shields.io/github/license/silviucpp/erlkaf)](https://github.com/silviucpp/erlkaf/blob/master/LICENSE)
[![Hex.pm](https://img.shields.io/hexpm/v/erlkaf)](https://hex.pm/packages/erlkaf)

*Erlang kafka driver based on [librdkafka][1]*
Expand Down
4 changes: 2 additions & 2 deletions build_deps.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

ROOT=$(pwd)
DEPS_LOCATION=deps
DEPS_LOCATION=_build/deps
OS=$(uname -s)
KERNEL=$(echo $(lsb_release -ds 2>/dev/null || cat /etc/*release 2>/dev/null | head -n1 | awk '{print $1;}') | awk '{print $1;}')
CPUS=`getconf _NPROCESSORS_ONLN 2>/dev/null || sysctl -n hw.ncpu`
Expand Down Expand Up @@ -73,7 +73,7 @@ BuildLibrary()
esac

fail_check ./configure
fail_check make -j $(CPUS)
fail_check make -j $CPUS

rm src/*.dylib
rm src/*.so
Expand Down
16 changes: 11 additions & 5 deletions c_src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@ PROJECT_NIF_NAME=erlkaf_nif
include nif.mk

ifeq ($(UNAME_SYS), darwin)
CXXFLAGS += -I/usr/local/opt/openssl/include
LDFLAGS += -L/usr/local/opt/openssl/lib \
OPENSSL_ROOT := $(shell brew --prefix [email protected])
LZ4_ROOT := $(shell brew --prefix lz4)
ZSTD_ROOT := $(shell brew --prefix zstd)

CXXFLAGS += -I$(OPENSSL_ROOT)/include
LDFLAGS += -L$(OPENSSL_ROOT)/lib \
-L$(LZ4_ROOT)/lib \
-L$(ZSTD_ROOT)/lib \
-L/usr/local/lib

LDFLAGS += -Wl,-U,_enif_alloc \
Expand Down Expand Up @@ -64,11 +70,11 @@ ifeq ($(UNAME_SYS), darwin)
endif

CXXFLAGS += -DNDEBUG \
-I ../deps/librdkafka/src \
-I ../deps \
-I ../_build/deps/librdkafka/src \
-I ../_build/deps \
-g -Wextra -Werror -Wno-missing-field-initializers -fno-exceptions -fno-rtti -std=c++11

LDFLAGS += -L ../deps/librdkafka/src \
LDFLAGS += -L ../_build/deps/librdkafka/src \
-lrdkafka \
-lsasl2 \
-lz \
Expand Down
6 changes: 3 additions & 3 deletions c_src/nif.mk
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ UNAME_SYS = $(shell echo $(UNAME_SYS_ORG) | tr A-Z a-z)

ifeq ($(UNAME_SYS), darwin)
CC ?= cc
CFLAGS ?= -O3 -std=c99 -arch x86_64 -finline-functions -Wall
CXXFLAGS ?= -O3 -arch x86_64 -Wall
LDFLAGS ?= -arch x86_64
CFLAGS ?= -O3 -std=c99 -finline-functions -Wall
CXXFLAGS ?= -O3 -Wall
LDFLAGS ?=
else ifeq ($(UNAME_SYS), freebsd)
CC ?= cc
CFLAGS ?= -O3 -std=c99 -finline-functions -Wall
Expand Down
2 changes: 1 addition & 1 deletion src/erlkaf.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{description, "erlkaf - Erlang Kafka library based on librdkafka"},
{licenses, ["MIT"]},
{links,[{"Github","https://github.com/silviucpp/erlkaf"}]},
{vsn, "2.0.7"},
{vsn, "2.0.8"},
{registered, []},
{applications, [
kernel,
Expand Down

0 comments on commit a17afb9

Please sign in to comment.