mirror of
https://github.com/Zygo/bees.git
synced 2025-05-17 13:25:45 +02:00
build: make libcrucible a static library
libcrucible at one time in the distant past had to be a shared library to force global C++ object initialization; however, this is no longer required. Make libcrucible static to solve various rpath and soname versioning issues, especially when distros try (unwisely) to package the library separately. Signed-off-by: Zygo Blaxell <bees@furryterror.org>
This commit is contained in:
parent
f17cf084e6
commit
7933ccb660
7
Makefile
7
Makefile
@ -49,16 +49,13 @@ scripts/%: scripts/%.in
|
||||
|
||||
scripts: scripts/beesd scripts/beesd@.service
|
||||
|
||||
install_libs: lib
|
||||
install -Dm644 lib/libcrucible.so $(DESTDIR)$(LIB_PREFIX)/libcrucible.so
|
||||
|
||||
install_tools: ## Install support tools + libs
|
||||
install_tools: install_libs src
|
||||
install_tools: src
|
||||
install -Dm755 bin/fiemap $(DESTDIR)$(PREFIX)/bin/fiemap
|
||||
install -Dm755 bin/fiewalk $(DESTDIR)$(PREFIX)/sbin/fiewalk
|
||||
|
||||
install_bees: ## Install bees + libs
|
||||
install_bees: install_libs src $(RUN_INSTALL_TESTS)
|
||||
install_bees: src $(RUN_INSTALL_TESTS)
|
||||
install -Dm755 bin/bees $(DESTDIR)$(LIBEXEC_PREFIX)/bees
|
||||
|
||||
install_scripts: ## Install scipts
|
||||
|
@ -62,9 +62,8 @@ packages.
|
||||
Build from source
|
||||
-----------------
|
||||
|
||||
Build with `make`. The build produces `bin/bees` and `lib/libcrucible.so`,
|
||||
which must be copied to somewhere in `$PATH` and `$LD_LIBRARY_PATH`
|
||||
on the target system respectively.
|
||||
Build with `make`. The build produces `bin/bees` which must be copied
|
||||
to somewhere in `$PATH` on the target system respectively.
|
||||
|
||||
It will also generate `scripts/beesd@.service` for systemd users. This
|
||||
service makes use of a helper script `scripts/beesd` to boot the service.
|
||||
|
10
lib/Makefile
10
lib/Makefile
@ -1,7 +1,7 @@
|
||||
TAG ?= $(shell git describe --always --dirty || echo UNKNOWN)
|
||||
|
||||
default: libcrucible.so
|
||||
%.so: Makefile
|
||||
default: libcrucible.a
|
||||
%.a: Makefile
|
||||
|
||||
CRUCIBLE_OBJS = \
|
||||
chatter.o \
|
||||
@ -44,7 +44,7 @@ depends.mk: $(CRUCIBLE_OBJS:%.o=.depends/%.dep)
|
||||
include depends.mk
|
||||
|
||||
%.o: %.cc ../makeflags
|
||||
$(CXX) $(BEES_CXXFLAGS) -fPIC -o $@ -c $<
|
||||
$(CXX) $(BEES_CXXFLAGS) -o $@ -c $<
|
||||
|
||||
libcrucible.so: $(CRUCIBLE_OBJS) .version.o
|
||||
$(CXX) $(BEES_LDFLAGS) -fPIC -shared -Wl,-soname,$@ -o $@ $^ -luuid
|
||||
libcrucible.a: $(CRUCIBLE_OBJS) .version.o
|
||||
$(AR) rcs $@ $^
|
||||
|
@ -7,7 +7,7 @@ CCFLAGS = -Wall -Wextra -Werror -O3
|
||||
# Debug:
|
||||
# CCFLAGS = -Wall -Wextra -Werror -O0 -ggdb
|
||||
|
||||
CCFLAGS += -I../include -fpic -D_FILE_OFFSET_BITS=64
|
||||
CCFLAGS += -I../include -D_FILE_OFFSET_BITS=64
|
||||
|
||||
BEES_CFLAGS = $(CCFLAGS) -std=c99 $(CFLAGS)
|
||||
BEES_CXXFLAGS = $(CCFLAGS) -std=c++11 -Wold-style-cast $(CXXFLAGS)
|
||||
|
@ -7,7 +7,7 @@ all: $(BEES) $(PROGRAMS)
|
||||
|
||||
include ../makeflags
|
||||
|
||||
LIBS = -lcrucible -lpthread
|
||||
LIBS = -lcrucible -luuid -lpthread
|
||||
BEES_LDFLAGS = -L../lib $(LDFLAGS)
|
||||
|
||||
BEES_OBJS = \
|
||||
|
@ -16,7 +16,7 @@ FORCE:
|
||||
include ../makeflags
|
||||
|
||||
LIBS = -lcrucible -lpthread
|
||||
BEES_LDFLAGS = -L../lib -Wl,-rpath=$(abspath ../lib) $(LDFLAGS)
|
||||
BEES_LDFLAGS = -L../lib $(LDFLAGS)
|
||||
|
||||
.depends:
|
||||
mkdir -p $@
|
||||
|
Loading…
x
Reference in New Issue
Block a user