From 2fe86c64b5b872d2a996a4c2bf9a4ed33ab72932 Mon Sep 17 00:00:00 2001 From: silviu caragea Date: Sat, 12 Feb 2022 14:03:12 +0200 Subject: [PATCH] Improve build scripts --- CHANGELOG.md | 4 ++++ build_deps.sh | 3 ++- c_src/Makefile | 6 ++++-- c_src/nif.mk | 6 +++--- src/erlcass.app.src | 2 +- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index baaf2bd..901de7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ### Changelog: +##### v4.0.6 + +- Improve build scripts + ##### v4.0.5 - Fix compilation error under elixir 1.13 diff --git a/build_deps.sh b/build_deps.sh index c538f81..acb88f4 100755 --- a/build_deps.sh +++ b/build_deps.sh @@ -7,6 +7,7 @@ if [ -d "$DEPS_LOCATION" ]; then exit 0 fi +CPUS=`getconf _NPROCESSORS_ONLN 2>/dev/null || sysctl -n hw.ncpu` OS=$(uname -s) if [ -x "$(command -v lsb_release)" ]; then KERNEL=$(lsb_release -is | tr '[:upper:]' '[:lower:]') @@ -95,5 +96,5 @@ popd mkdir -p $DEPS_LOCATION/cpp-driver/build pushd $DEPS_LOCATION/cpp-driver/build cmake .. -DCASS_BUILD_STATIC=ON -DCMAKE_BUILD_TYPE=RELEASE -make -j 12 +make -j $CPUS popd diff --git a/c_src/Makefile b/c_src/Makefile index cfde00a..d38a76b 100644 --- a/c_src/Makefile +++ b/c_src/Makefile @@ -5,10 +5,12 @@ include nif.mk ifeq ($(UNAME_SYS), darwin) - CXXFLAGS += -I/usr/local/opt/openssl/include \ + OPENSSL_ROOT := $(shell brew --prefix openssl@1.1) + + CXXFLAGS += -I$(OPENSSL_ROOT)/include \ -I/usr/local/include \ - LDFLAGS += -L/usr/local/opt/openssl/lib \ + LDFLAGS += -L$(OPENSSL_ROOT)/lib \ -L/usr/local/lib \ -Wl,-U,_enif_alloc \ -Wl,-U,_enif_free \ diff --git a/c_src/nif.mk b/c_src/nif.mk index adfd3fb..d19cf65 100644 --- a/c_src/nif.mk +++ b/c_src/nif.mk @@ -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 diff --git a/src/erlcass.app.src b/src/erlcass.app.src index 41c5396..05ef7bd 100644 --- a/src/erlcass.app.src +++ b/src/erlcass.app.src @@ -2,7 +2,7 @@ {description, "ErlCass - Erlang Cassandra Driver"}, {licenses, ["MIT"]}, {links,[{"Github","https://github.com/silviucpp/erlcass"}]}, - {vsn, "4.0.5"}, + {vsn, "4.0.6"}, {registered, []}, {applications, [kernel, stdlib, lager]}, {mod, {erlcass_app, []}},