1
0
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:
Zygo Blaxell 2018-12-09 17:23:54 -05:00
parent f17cf084e6
commit 7933ccb660
6 changed files with 12 additions and 16 deletions

View File

@ -49,16 +49,13 @@ scripts/%: scripts/%.in
scripts: scripts/beesd scripts/beesd@.service 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 support tools + libs
install_tools: install_libs src install_tools: src
install -Dm755 bin/fiemap $(DESTDIR)$(PREFIX)/bin/fiemap install -Dm755 bin/fiemap $(DESTDIR)$(PREFIX)/bin/fiemap
install -Dm755 bin/fiewalk $(DESTDIR)$(PREFIX)/sbin/fiewalk install -Dm755 bin/fiewalk $(DESTDIR)$(PREFIX)/sbin/fiewalk
install_bees: ## Install bees + libs 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 -Dm755 bin/bees $(DESTDIR)$(LIBEXEC_PREFIX)/bees
install_scripts: ## Install scipts install_scripts: ## Install scipts

View File

@ -62,9 +62,8 @@ packages.
Build from source Build from source
----------------- -----------------
Build with `make`. The build produces `bin/bees` and `lib/libcrucible.so`, Build with `make`. The build produces `bin/bees` which must be copied
which must be copied to somewhere in `$PATH` and `$LD_LIBRARY_PATH` to somewhere in `$PATH` on the target system respectively.
on the target system respectively.
It will also generate `scripts/beesd@.service` for systemd users. This It will also generate `scripts/beesd@.service` for systemd users. This
service makes use of a helper script `scripts/beesd` to boot the service. service makes use of a helper script `scripts/beesd` to boot the service.

View File

@ -1,7 +1,7 @@
TAG ?= $(shell git describe --always --dirty || echo UNKNOWN) TAG ?= $(shell git describe --always --dirty || echo UNKNOWN)
default: libcrucible.so default: libcrucible.a
%.so: Makefile %.a: Makefile
CRUCIBLE_OBJS = \ CRUCIBLE_OBJS = \
chatter.o \ chatter.o \
@ -44,7 +44,7 @@ depends.mk: $(CRUCIBLE_OBJS:%.o=.depends/%.dep)
include depends.mk include depends.mk
%.o: %.cc ../makeflags %.o: %.cc ../makeflags
$(CXX) $(BEES_CXXFLAGS) -fPIC -o $@ -c $< $(CXX) $(BEES_CXXFLAGS) -o $@ -c $<
libcrucible.so: $(CRUCIBLE_OBJS) .version.o libcrucible.a: $(CRUCIBLE_OBJS) .version.o
$(CXX) $(BEES_LDFLAGS) -fPIC -shared -Wl,-soname,$@ -o $@ $^ -luuid $(AR) rcs $@ $^

View File

@ -7,7 +7,7 @@ CCFLAGS = -Wall -Wextra -Werror -O3
# Debug: # Debug:
# CCFLAGS = -Wall -Wextra -Werror -O0 -ggdb # 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_CFLAGS = $(CCFLAGS) -std=c99 $(CFLAGS)
BEES_CXXFLAGS = $(CCFLAGS) -std=c++11 -Wold-style-cast $(CXXFLAGS) BEES_CXXFLAGS = $(CCFLAGS) -std=c++11 -Wold-style-cast $(CXXFLAGS)

View File

@ -7,7 +7,7 @@ all: $(BEES) $(PROGRAMS)
include ../makeflags include ../makeflags
LIBS = -lcrucible -lpthread LIBS = -lcrucible -luuid -lpthread
BEES_LDFLAGS = -L../lib $(LDFLAGS) BEES_LDFLAGS = -L../lib $(LDFLAGS)
BEES_OBJS = \ BEES_OBJS = \

View File

@ -16,7 +16,7 @@ FORCE:
include ../makeflags include ../makeflags
LIBS = -lcrucible -lpthread LIBS = -lcrucible -lpthread
BEES_LDFLAGS = -L../lib -Wl,-rpath=$(abspath ../lib) $(LDFLAGS) BEES_LDFLAGS = -L../lib $(LDFLAGS)
.depends: .depends:
mkdir -p $@ mkdir -p $@