Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/stage' into dim-cdt
Browse files Browse the repository at this point in the history
  • Loading branch information
xorphox committed Jan 24, 2024
2 parents f702546 + c489326 commit 8c0c820
Show file tree
Hide file tree
Showing 113 changed files with 3,050 additions and 1,486 deletions.
4 changes: 0 additions & 4 deletions .build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,16 @@ name: aerospike-client-c

container:
- base:
- docker.qe.aerospike.com/build/aerospike-client-c:centos-7
- docker.qe.aerospike.com/build/aerospike-client-c:rhel-8
- docker.qe.aerospike.com/build/aerospike-client-c:rhel-9
- docker.qe.aerospike.com/build/aerospike-client-c:amazonlinux-2023
- docker.qe.aerospike.com/build/aerospike-client-c:debian-10
- docker.qe.aerospike.com/build/aerospike-client-c:debian-11
- docker.qe.aerospike.com/build/aerospike-client-c:debian-12
- docker.qe.aerospike.com/build/aerospike-client-c:ubuntu-20.04
- docker.qe.aerospike.com/build/aerospike-client-c:ubuntu-22.04
- docker.qe.aerospike.com/build/aerospike-client-c:arm-centos-7
- docker.qe.aerospike.com/build/aerospike-client-c:arm-rhel-8
- docker.qe.aerospike.com/build/aerospike-client-c:arm-rhel-9
- docker.qe.aerospike.com/build/aerospike-client-c:arm-amazonlinux-2023
- docker.qe.aerospike.com/build/aerospike-client-c:arm-debian-10
- docker.qe.aerospike.com/build/aerospike-client-c:arm-debian-11
- docker.qe.aerospike.com/build/aerospike-client-c:arm-debian-12
- docker.qe.aerospike.com/build/aerospike-client-c:arm-ubuntu-20.04
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ name: Aerospike C Client Tests

on:
push:
branches:
- master
branches: [master, stage]
pull_request:
branches:
- master
branches: [master, stage]

jobs:
build:
Expand Down
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,3 @@
path = modules/lua
url = https://github.com/aerospike/lua.git
ignore = dirty
[submodule "modules/luajit"]
path = modules/luajit
url = https://github.com/aerospike/luajit.git
ignore = dirty
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Aerospike C Client License
==========================

Copyright 2008-2022 Aerospike, Inc.
Copyright 2008-2024 Aerospike, Inc.

Portions may be licensed to Aerospike, Inc. under one or more contributor
license agreements.
Expand Down
131 changes: 38 additions & 93 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,47 +4,32 @@
include project/settings.mk

# Modules
COMMON := modules/common
LUAMOD := modules/lua
LUAJIT := modules/luajit
MOD_LUA := modules/mod-lua
MODULES := COMMON MOD_LUA

# Use the Lua submodule? [By default, yes.]
USE_LUAMOD = 1

# Use LuaJIT instead of Lua? [By default, no.]
USE_LUAJIT = 0

# Permit easy overriding of the default.
ifeq ($(USE_LUAJIT),1)
USE_LUAMOD = 0
endif

ifeq ($(and $(USE_LUAMOD:0=),$(USE_LUAJIT:0=)),1)
$(error Only at most one of USE_LUAMOD or USE_LUAJIT may be enabled (i.e., set to 1.))
else
ifeq ($(USE_LUAMOD),1)
MODULES += LUAMOD
else
ifeq ($(USE_LUAJIT),1)
MODULES += LUAJIT
endif
endif
endif
COMMON := $(abspath modules/common)
LUAMOD := $(abspath modules/lua)
MOD_LUA := $(abspath modules/mod-lua)
MODULES := COMMON
MODULES += MOD_LUA

# Override optimizations via: make O=n
O = 3

# Make-local Compiler Flags
EXT_CFLAGS =
CC_FLAGS = -std=gnu99 -g -Wall -fPIC -O$(O)
CC_FLAGS += -fno-common -fno-strict-aliasing
CC_FLAGS += -D_FILE_OFFSET_BITS=64 -D_REENTRANT -D_GNU_SOURCE $(EXT_CFLAGS)

ifeq ($(ARCH),x86_64)
CC_FLAGS += -march=nocona
REAL_ARCH = -march=nocona
endif

ifeq ($(ARCH),aarch64)
REAL_ARCH = -mcpu=neoverse-n1
endif

CC_CFLAGS += $(REAL_ARCH)
EVENT_LIB =

ifeq ($(EVENT_LIB),libev)
CC_FLAGS += -DAS_USE_LIBEV
endif
Expand All @@ -59,12 +44,13 @@ endif

ifeq ($(OS),Darwin)
CC_FLAGS += -D_DARWIN_UNLIMITED_SELECT -I/usr/local/include
LUA_PLATFORM = LUA_USE_MACOSX

ifneq ($(wildcard /opt/homebrew/include),)
# Mac new homebrew external include path
CC_FLAGS += -I/opt/homebrew/include
else ifneq ($(wildcard /usr/local/opt/libevent/include),)
# Mac old homebrew libevent include path
# Mac old homebrew libevent include path
CC_FLAGS += -I/usr/local/opt/libevent/include
endif

Expand All @@ -78,22 +64,20 @@ ifeq ($(OS),Darwin)
# macports openssl include path
CC_FLAGS += -I/opt/local/include
endif

LUA_PLATFORM = macosx
else ifeq ($(OS),FreeBSD)
CC_FLAGS += -finline-functions -I/usr/local/include
LUA_PLATFORM = freebsd
LUA_PLATFORM = LUA_USE_LINUX # nothing BSD specific in luaconf.h
else
CC_FLAGS += -finline-functions -rdynamic
LUA_PLATFORM = linux
LUA_PLATFORM = LUA_USE_LINUX

ifneq ($(wildcard /etc/alpine-release),)
CC_FLAGS += -DAS_ALPINE
endif
endif

# Linker flags
LD_FLAGS = $(LDFLAGS)
LD_FLAGS = $(LDFLAGS)

ifeq ($(OS),Darwin)
LD_FLAGS += -undefined dynamic_lookup
Expand All @@ -107,37 +91,9 @@ ifdef DEBUG
endif

# Include Paths
INC_PATH += $(COMMON)/$(TARGET_INCL)
INC_PATH += $(MOD_LUA)/$(TARGET_INCL)

# Library Paths
# LIB_PATH +=

ifeq ($(USE_LUAMOD),1)
INC_PATH += $(LUAMOD)/src
else
ifeq ($(USE_LUAJIT),1)
INC_PATH += $(LUAJIT)/src
else
# Find where the Lua development package is installed in the build environment.
INC_PATH += $(or \
$(wildcard /usr/include/lua-5.1), \
$(wildcard /usr/include/lua5.1))
INCLUDE_LUA_5_1 = /usr/include/lua5.1
ifneq ($(wildcard $(INCLUDE_LUA_5_1)),)
LUA_SUFFIX=5.1
endif
ifeq ($(OS),Darwin)
ifneq ($(wildcard /usr/local/include),)
INC_PATH += /usr/local/include
endif
ifneq ($(wildcard /usr/local/lib),)
LIB_LUA = -L/usr/local/lib
endif
endif
LIB_LUA += -llua$(LUA_SUFFIX)
endif
endif
INC_PATH += $(COMMON)/$(SOURCE_INCL)
INC_PATH += $(MOD_LUA)/$(SOURCE_INCL)
INC_PATH += $(LUAMOD)

###############################################################################
## OBJECTS ##
Expand Down Expand Up @@ -203,20 +159,14 @@ AEROSPIKE += version.o
OBJECTS :=
OBJECTS += $(AEROSPIKE:%=$(TARGET_OBJ)/aerospike/%)

DEPS :=
DEPS =
DEPS += $(COMMON)/$(TARGET_OBJ)/common/aerospike/*.o
DEPS += $(COMMON)/$(TARGET_OBJ)/common/citrusleaf/*.o
DEPS += $(MOD_LUA)/$(TARGET_OBJ)/*.o

ifeq ($(USE_LUAMOD),1)
LUA_DYNAMIC_OBJ = $(filter-out $(LUAMOD)/src/lua.o $(LUAMOD)/src/luac.o, $(shell ls $(LUAMOD)/src/*.o))
LUA_STATIC_OBJ = $(LUA_DYNAMIC_OBJ)
else
ifeq ($(USE_LUAJIT),1)
LUA_DYNAMIC_OBJ = $(shell ls $(LUAJIT)/src/*_dyn.o)
LUA_STATIC_OBJ = $(filter-out $(LUA_DYNAMIC_OBJ) $(LUAJIT)/src/luajit.o, $(shell ls $(LUAJIT)/src/*.o))
endif
endif
EXP_DEPS := $(foreach DD, $(DEPS), $(wildcard $(DEP)))

LUA_OBJECTS = $(filter-out $(LUAMOD)/lua.o, $(shell ls $(LUAMOD)/*.o))

###############################################################################
## HEADERS ##
Expand All @@ -233,8 +183,9 @@ COMMON-HEADERS += $(COMMON)/$(SOURCE_INCL)/citrusleaf/cf_queue.h

EXCLUDE-HEADERS =

HEADERS :=
HEADERS += $(filter-out $(EXCLUDE-HEADERS), $(wildcard $(SOURCE_INCL)/aerospike/*.h))
AEROSPIKE-HEADERS := $(filter-out $(EXCLUDE-HEADERS), $(wildcard $(SOURCE_INCL)/aerospike/*.h))

HEADERS := $(AEROSPIKE-HEADERS)
HEADERS += $(COMMON-HEADERS)

###############################################################################
Expand All @@ -256,8 +207,7 @@ version:
build: libaerospike

.PHONY: prepare
prepare: modules-prepare $(subst $(SOURCE_INCL),$(TARGET_INCL),$(HEADERS))
$(noop)
prepare: modules-prepare $(subst $(SOURCE_INCL),$(TARGET_INCL),$(AEROSPIKE-HEADERS))

.PHONY: prepare-clean
prepare-clean:
Expand Down Expand Up @@ -298,23 +248,18 @@ tags etags:
## BUILD TARGETS ##
###############################################################################

$(TARGET_OBJ)/%.o: $(COMMON)/$(TARGET_LIB)/libaerospike-common.a $(MOD_LUA)/$(TARGET_LIB)/libmod_lua.a $(SOURCE_MAIN)/%.c $(SOURCE_INCL)/citrusleaf/*.h | modules
$(TARGET_OBJ)/aerospike/%.o: $(SOURCE_MAIN)/aerospike/%.c
$(object)

$(TARGET_OBJ)/aerospike/%.o: $(COMMON)/$(TARGET_LIB)/libaerospike-common.a $(MOD_LUA)/$(TARGET_LIB)/libmod_lua.a $(SOURCE_MAIN)/aerospike/%.c $(SOURCE_INCL)/citrusleaf/*.h $(SOURCE_INCL)/aerospike/*.h | modules
$(object)

$(TARGET_LIB)/libaerospike.$(DYNAMIC_SUFFIX): $(OBJECTS) | modules
$(library) $(DEPS) $(LUA_DYNAMIC_OBJ)

$(TARGET_LIB)/libaerospike.a: $(OBJECTS) | modules
$(archive) $(DEPS) $(LUA_STATIC_OBJ)
$(TARGET_LIB)/libaerospike.$(DYNAMIC_SUFFIX): $(OBJECTS) $(EXP_DEPS) | modules
$(library) $(DEPS) $(LUA_OBJECTS)

$(TARGET_INCL)/aerospike: | $(TARGET_INCL)
mkdir $@
$(TARGET_LIB)/libaerospike.a: $(OBJECTS) $(EXP_DEPS) | modules
$(archive) $(DEPS) $(LUA_OBJECTS)

$(TARGET_INCL)/aerospike/%.h: $(SOURCE_INCL)/aerospike/%.h | $(TARGET_INCL)/aerospike
cp -p $^ $@
$(TARGET_INCL)/aerospike/%.h: $(SOURCE_INCL)/aerospike/%.h
@mkdir -p $(@D)
cp -p $< $@

###############################################################################
include project/modules.mk project/test.mk project/rules.mk
Expand Down
34 changes: 4 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,18 @@ are also included.
[Also do on Ubuntu:]
$ sudo apt-get install ncurses-dev

[Optional:]
$ sudo apt-get install liblua5.1-dev

### Red Hat Enterprise Linux, CentOS and Amazon Linux

$ sudo yum install openssl-devel glibc-devel autoconf automake libtool

[Optional:]
$ sudo yum install lua-devel
$ sudo yum install gcc-c++ graphviz rpm-build

### Fedora

$ sudo yum install openssl-devel glibc-devel autoconf automake libtool

[Optional:]
$ sudo yum install compat-lua-devel-5.1.5
$ sudo yum install gcc-c++ graphviz rpm-build

### MacOS
Expand All @@ -46,6 +41,10 @@ Run this script after installing XCode and Brew:

See [Windows Build](vs).

### OpenSSL Library

This minimum OpenSSL library version is 1.0.2.

### Event Library (Optional)

An event library is required when C client asynchronous functionality is used.
Expand Down Expand Up @@ -150,31 +149,6 @@ To install header files and library on the current machine:

$ sudo make install

## Lua

The C client requires [Lua](http://www.lua.org) 5.1 support for the
client-side portion of User Defined Function (UDF) query aggregation.
By default, the C client builds with Lua support provided by the
included `lua` submodule.

Optionally, Lua support may be provided by either the included `luajit`
submodule or by the build environment.

To enable [LuaJIT](http://luajit.org) 2.0.3, the build must be performed
with the `USE_LUAJIT=1` option passed on all relevant `make` command
lines (i.e., the C client itself and API examples).
[Note that on some platforms, [Valgrind](http://www.valgrind.org)
may not function out-of-the-box on applications built with the C client
when LuaJIT is enabled without using an unreleased version of LuaJIT
built with additional options.]

To use Lua provided by the development environment, either the `lua5.1`
development package may be installed (on platforms that have it), or
else Lua 5.1.5 may be built from the source release and installed into
the standard location (usually `/usr/local/`.) In either of these two
cases, the build must be performed with the option `USE_LUAMOD=0` passed
on all relevant `make` command lines.

## Package

Installer packages can be created for RedHat (rpm), Debian (deb), Mac OS X (pkg).
Expand Down
Loading

0 comments on commit 8c0c820

Please sign in to comment.