diff --git a/omnibus/config/patches/lmdb/allow-makefile-override-vars.diff b/omnibus/config/patches/lmdb/allow-makefile-override-vars.diff new file mode 100644 index 0000000000000..20669bb5383af --- /dev/null +++ b/omnibus/config/patches/lmdb/allow-makefile-override-vars.diff @@ -0,0 +1,22 @@ +--- a/Makefile 2023-12-06 12:09:29.871461460 +0100 ++++ b/Makefile 2023-12-06 12:10:29.907352846 +0100 +@@ -18,16 +18,16 @@ + # There may be other macros in mdb.c of interest. You should + # read mdb.c before changing any of them. + # +-CC = gcc +-AR = ar ++CC ?= gcc ++AR ?= ar + W = -W -Wall -Wno-unused-parameter -Wbad-function-cast -Wuninitialized + THREADS = -pthread + OPT = -O2 -g + CFLAGS = $(THREADS) $(OPT) $(W) $(XCFLAGS) + LDLIBS = + SOLIBS = + SOEXT = .so +-prefix = /usr/local ++prefix ?= /usr/local + exec_prefix = $(prefix) + bindir = $(exec_prefix)/bin + libdir = $(exec_prefix)/lib diff --git a/omnibus/config/software/lmdb.rb b/omnibus/config/software/lmdb.rb index 265ffaa8d0398..eff46d1c707e4 100644 --- a/omnibus/config/software/lmdb.rb +++ b/omnibus/config/software/lmdb.rb @@ -10,11 +10,10 @@ build do license "OpenLDAP Public License" license_file "https://raw.githubusercontent.com/LMDB/lmdb/LMDB_#{version}/libraries/liblmdb/COPYRIGHT" - env = { - "LDFLAGS" => "-L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include", - "CFLAGS" => "-L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include", - "LD_RUN_PATH" => "#{install_dir}/embedded/lib", - } + patch source: "allow-makefile-override-vars.diff" + env = with_standard_compiler_flags(with_embedded_path) + env["prefix"] = "#{install_dir}/embedded/" + env["XCFLAGS"] = env["CFLAGS"] # https://www.linuxfromscratch.org/blfs/view/8.3/server/lmdb.html command "make -j #{workers}", :env => env @@ -24,13 +23,6 @@ else command "sed -i 's| liblmdb.a||' Makefile", :env => env end - - # We have to manually move the files into the correct directories because the Makefile for lmdb hardcodes the install directory to `/usr/local`, although we need this to be `#{install_dir}/embedded` - copy "liblmdb.so", "#{install_dir}/embedded/lib/liblmdb.so" - copy "lmdb.h", "#{install_dir}/embedded/include/lmdb.h" - copy "mdb_stat", "#{install_dir}/embedded/bin/mdb_stat" - copy "mdb_copy", "#{install_dir}/embedded/bin/mdb_copy" - copy "mdb_dump", "#{install_dir}/embedded/bin/mdb_dump" - copy "mdb_load", "#{install_dir}/embedded/bin/mdb_load" + command "make install", :env => env end