Redis Graph on FreeBSD

Dear team,

Although Redis Graph and its dependencies do not support FreeBSD platform, there is a little workaround to build and to use these modules on a FreeBSD server. I’d like to share this dirty workaround which maybe transform later into a PR to officialize FreeBSD support.
Here is the way I have used and seems to work:

# Firstly we have to install some dependencies from ports: math/openlibm devel/openmp devel/gmake

# Clone project files
git clone --recurse-submodules -j8 https://github.com/RedisGraph/RedisGraph.git
cd RedisGraph

# Replace the original build dir with empty one, just in case
rm -rf deps/GraphBLAS/build/
mkdir deps/GraphBLAS/build/

# Roughly add header to define `struct iovec' (on FreeBSD this must be included explicitly)
perl -i.bak -pe '$.==18&&s,^,#include <sys/uio.h>\n,' ./deps/RediSearch/src/fork_gc.c

# There is a bug on my 64-bit FreeBSD using 128-bit assignment (SIGBUS) thus roughly fix it disabling 128-bit mode:
perl -i.bak -pe '/fPIC/&&s/fPIC/fPIC -DRS_NO_U128/' ./deps/RediSearch/cmake/redisearch_cflags.cmake

# Roughly add header to define cpow/clog (which are absent at least on FreeBSD 10, 11)
perl -i.bak -pe '$.==12&&s,^,#include <openlibm/openlibm_complex.h>\n,' ./deps/GraphBLAS/Source/GB.h

# Roughly remove ldl as it's included into libc on FreeBSD and must not be defined
perl -i.bak -pe 's,\b-ldl\b,,' ./deps/GraphBLAS/CUDA/Makefile
perl -i.bak -pe '/TARGET_LINK_LIBRARIES/&&s/\bdl\sm/openlib/' ./deps/RediSearch/CMakeLists.txt

# Roughly add new Makefile section to define flags for FreeBSD, with -lopenlibm and without -ldl
perl -i.bak -pe '$.==28&&/else/&&s@^@else ifeq (\$(uname_S),FreeBSD)\n\tSHOBJ_LDFLAGS ?= -shared -Bsymbolic -Bsymbolic-functions -lpthread -fopenmp -lopenlibm\n\texport OS = Linux\n@' ./src/Makefile

# Roughly replace libm with openlibm to make it link against correct library
perl -i.bak -pe '/REDISGRAPH_CC/s/-lm\b/-lopenlibm/' ./src/Makefile

# Set some variables to make Cmake find OpenMP and libopenlibm
C_INCLUDE_PATH=/usr/local/include
CFLAGS='-fPIC -I/usr/local/include'
LIBRARY_PATH=/usr/local/lib
CPLUS_INCLUDE_PATH=/usr/local/include
MAKE=gmake
export C_INCLUDE_PATH CFLAGS LIBRARY_PATH CPLUS_INCLUDE_PATH MAKE

# Run build process
gmake

Any thoughts?