-
Notifications
You must be signed in to change notification settings - Fork 269
Improve build system #262
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
base: main
Are you sure you want to change the base?
Improve build system #262
Changes from all commits
d657876
7cfacf0
26818f5
b7bf5ec
d59a46c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,7 @@ WITH_NVCGO ?= yes | |
| WITH_LIBELF ?= no | ||
| WITH_TIRPC ?= no | ||
| WITH_SECCOMP ?= yes | ||
| STRIP_DEBUG_INFO ?= yes | ||
|
henry118 marked this conversation as resolved.
|
||
|
|
||
| ##### Global definitions ##### | ||
|
|
||
|
|
@@ -162,6 +163,9 @@ else | |
| LIB_LDLIBS_STATIC += -l:libelf.a | ||
| endif | ||
| ifeq ($(WITH_TIRPC), yes) | ||
| LIB_CPPFLAGS += -DWITH_TIRPC $(shell pkg-config --cflags libtirpc) | ||
| LIB_LDLIBS_SHARED += -lpthread $(shell pkg-config --libs libtirpc) | ||
| else | ||
| LIB_CPPFLAGS += -isystem $(DEPS_DIR)$(includedir)/tirpc -DWITH_TIRPC | ||
| LIB_LDLIBS_STATIC += -l:libtirpc.a | ||
| LIB_LDLIBS_SHARED += -lpthread | ||
|
|
@@ -219,22 +223,28 @@ $(BIN_OBJS): %.o: %.c | shared | |
| -include $(DEPENDENCIES) | ||
|
|
||
| $(LIB_SHARED): $(LIB_OBJS) | ||
| $(MKDIR) -p $(DEBUG_DIR) | ||
| $(CC) $(LIB_CFLAGS) $(LIB_CPPFLAGS) $(LIB_LDFLAGS) $(OUTPUT_OPTION) $^ $(LIB_SCRIPT) $(LIB_LDLIBS) | ||
| ifeq ($(STRIP_DEBUG_INFO), yes) | ||
| $(MKDIR) -p $(DEBUG_DIR) | ||
| $(OBJCPY) --only-keep-debug $@ $(LIB_SONAME) | ||
| $(OBJCPY) --add-gnu-debuglink=$(LIB_SONAME) $@ | ||
| $(MV) $(LIB_SONAME) $(DEBUG_DIR) | ||
| $(STRIP) --strip-unneeded -R .comment $@ | ||
| endif | ||
|
|
||
| $(LIB_STATIC_OBJ): $(LIB_OBJS) | ||
| # FIXME Handle user-defined LDFLAGS and LDLIBS | ||
| $(LD) -d -r --exclude-libs ALL -L$(DEPS_DIR)$(libdir) $(OUTPUT_OPTION) $^ $(LIB_LDLIBS_STATIC) | ||
| ifeq ($(STRIP_DEBUG_INFO), yes) | ||
| $(OBJCPY) --localize-hidden $@ | ||
| $(STRIP) --strip-unneeded -R .comment $@ | ||
| endif | ||
|
|
||
| $(BIN_NAME): $(BIN_OBJS) | ||
| $(CC) $(BIN_CFLAGS) $(BIN_CPPFLAGS) $(BIN_LDFLAGS) $(OUTPUT_OPTION) $^ $(BIN_SCRIPT) $(BIN_LDLIBS) | ||
| ifeq ($(STRIP_DEBUG_INFO), yes) | ||
| $(STRIP) --strip-unneeded -R .comment $@ | ||
| endif | ||
|
|
||
| ##### Public rules ##### | ||
|
|
||
|
|
@@ -262,12 +272,12 @@ endif | |
| ifeq ($(WITH_LIBELF), no) | ||
| $(MAKE) -f $(MAKE_DIR)/elftoolchain.mk DESTDIR=$(DEPS_DIR) install | ||
| endif | ||
| ifeq ($(WITH_TIRPC), yes) | ||
| ifeq ($(WITH_TIRPC), no) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This flips the existing behavior. Currently we will build the library from source when this flag is This might break some platforms that package this repo.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As I wrote before: Well, the meaning of
Which other approach enabling linking to system libtirpc would you propose?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. imho we should keep the existing semantics.
My concern is that many downstream users might already depend on the current behavior and silently flipping the meaning would cause unexpected breaks.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
AFAICT, there is currently no way to build with system
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's the SunRPC implementation that used to be shipped as part of glibc. Like Ubuntu 18.04 and older, they often still had the glibc SunRPC headers. But modern distros would require To avoid changing the meaning of TIRPC_MODE ?= sunrpc
# sunrpc - use the platform-provided SunRPC implementation
# bundled - build and statically link the bundled libtirpc
# system - use the system libtirpc discovered through pkg-configThen preserve the existing flag as a compatibility shim: ifdef WITH_TIRPC
ifeq ($(WITH_TIRPC),yes)
TIRPC_MODE := bundled
else
TIRPC_MODE := sunrpc
endif
endifThis keeps existing build scripts working as they do today: make WITH_TIRPC=yes # still means bundled libtirpc
make WITH_TIRPC=no # still means SunRPCwhile allowing the new behavior explicitly: make TIRPC_MODE=system |
||
| $(MAKE) -f $(MAKE_DIR)/libtirpc.mk DESTDIR=$(DEPS_DIR) install | ||
| endif | ||
|
|
||
| install: all | ||
| $(INSTALL) -d -m 755 $(addprefix $(DESTDIR),$(includedir) $(bindir) $(libdir) $(docdir) $(libdbgdir) $(pkgconfdir)) | ||
| $(INSTALL) -d -m 755 $(addprefix $(DESTDIR),$(includedir) $(bindir) $(libdir) $(docdir) $(pkgconfdir)) | ||
| # Install header files | ||
| $(INSTALL) -m 644 $(LIB_INCS) $(DESTDIR)$(includedir) | ||
| # Install library files | ||
|
|
@@ -280,7 +290,10 @@ ifeq ($(WITH_NVCGO), yes) | |
| endif | ||
| $(LDCONFIG) -n $(DESTDIR)$(libdir) | ||
| # Install debugging symbols | ||
| ifeq ($(STRIP_DEBUG_INFO), yes) | ||
| $(INSTALL) -d -m 755 $(addprefix $(DESTDIR),$(libdbgdir)) | ||
| $(INSTALL) -m 644 $(DEBUG_DIR)/$(LIB_SONAME) $(DESTDIR)$(libdbgdir) | ||
| endif | ||
| # Install configuration files | ||
| $(MAKE_DIR)/$(LIB_PKGCFG).in "$(strip $(VERSION))" "$(strip $(LIB_LDLIBS_SHARED))" > $(DESTDIR)$(pkgconfdir)/$(LIB_PKGCFG) | ||
| # Install binary files | ||
|
|
@@ -298,7 +311,9 @@ ifeq ($(WITH_NVCGO), yes) | |
| $(RM) $(addprefix $(DESTDIR)$(libdir)/,$(LIBGO_SHARED) $(LIBGO_SONAME) $(LIBGO_SYMLINK)) | ||
| endif | ||
| # Uninstall debugging symbols | ||
| ifeq ($(STRIP_DEBUG_INFO), yes) | ||
| $(RM) $(DESTDIR)$(libdbgdir)/$(LIB_SONAME) | ||
| endif | ||
| # Uninstall configuration files | ||
| $(RM) $(DESTDIR)$(pkgconfdir)/$(LIB_PKGCFG) | ||
| # Uninstall binary files | ||
|
|
@@ -320,7 +335,7 @@ endif | |
| ifeq ($(WITH_LIBELF), no) | ||
| -$(MAKE) -f $(MAKE_DIR)/elftoolchain.mk clean | ||
| endif | ||
| ifeq ($(WITH_TIRPC), yes) | ||
| ifeq ($(WITH_TIRPC), no) | ||
| -$(MAKE) -f $(MAKE_DIR)/libtirpc.mk clean | ||
| endif | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.