Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

omnibus: lmdb: allow overriding build/install environment & use common env/flags #21462

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions omnibus/config/patches/lmdb/allow-makefile-override-vars.diff
Original file line number Diff line number Diff line change
@@ -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
18 changes: 5 additions & 13 deletions omnibus/config/software/lmdb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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