diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2023-10-30 21:38:41 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2023-10-30 21:38:41 +0000 |
commit | 0cc88a66c338b91d79084383ba374d82da87e837 (patch) | |
tree | 59abed0f99c48a364ae57d01681031a0b49620c8 | |
parent | 5be24a3642c294e4fcec465c9c6f19d66cf2220d (diff) | |
download | s6-portable-utils-0cc88a66c338b91d79084383ba374d82da87e837.tar.gz s6-portable-utils-0cc88a66c338b91d79084383ba374d82da87e837.tar.xz s6-portable-utils-0cc88a66c338b91d79084383ba374d82da87e837.zip |
Fix multicall symlink installation
Signed-off-by: Laurent Bercot <ska@appnovation.com>
-rw-r--r-- | Makefile | 27 | ||||
-rw-r--r-- | package/targets.mak | 2 |
2 files changed, 21 insertions, 8 deletions
diff --git a/Makefile b/Makefile index b82361b..f158e82 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,7 @@ SHARED_LIBS := INTERNAL_LIBS := EXTRA_TARGETS := LIB_DEFS := +BIN_SYMLINKS := define library_definition LIB$(firstword $(subst =, ,$(1))) := lib$(lastword $(subst =, ,$(1))).$(if $(DO_ALLSTATIC),a,so).xyzzy @@ -30,6 +31,19 @@ STATIC_LIBS += lib$(lastword $(subst =, ,$(1))).a.xyzzy endif endef +define binary_installation_rule +$(DESTDIR)$(1)/$(2): $(2) package/modes + exec $(INSTALL) -D -m 600 $$< $$@ + grep -- ^$$(@F) < package/modes | { read name mode owner && \ + if [ x$$$$owner != x ] ; then chown -- $$$$owner $$@ ; fi && \ + chmod $$$$mode $$@ ; } +endef + +define symlink_installation_rule +$(DESTDIR)$(1)/$(2): $(DESTDIR)$(1)/$(SYMLINK_TARGET_$(2)) + exec $(INSTALL) -l $$(<F) $$@ +endef + -include config.mak include package/targets.mak @@ -53,6 +67,10 @@ RANLIB := $(CROSS_COMPILE)ranlib STRIP := $(CROSS_COMPILE)strip INSTALL := ./tools/install.sh +$(foreach var,$(BIN_TARGETS),$(eval $(call binary_installation_rule,$(bindir),$(var)))) +$(foreach var,$(LIBEXEC_TARGETS),$(eval $(call binary_installation_rule,$(libexecdir),$(var)))) +$(foreach var,$(BIN_SYMLINKS),$(eval $(call symlink_installation_rule,$(bindir),$(var)))) + ALL_BINS := $(LIBEXEC_TARGETS) $(BIN_TARGETS) ALL_LIBS := $(SHARED_LIBS) $(STATIC_LIBS) $(INTERNAL_LIBS) ALL_INCLUDES := $(wildcard src/include/$(package)/*.h) @@ -81,10 +99,11 @@ ifneq ($(strip $(ALL_BINS)$(SHARED_LIBS)),) exec $(STRIP) -R .note -R .comment $(ALL_BINS) $(SHARED_LIBS) endif -install: install-dynlib install-libexec install-bin install-lib install-include +install: install-dynlib install-libexec install-bin install-symlinks install-lib install-include install-dynlib: $(SHARED_LIBS:lib%.so.xyzzy=$(DESTDIR)$(dynlibdir)/lib%.so) install-libexec: $(LIBEXEC_TARGETS:%=$(DESTDIR)$(libexecdir)/%) install-bin: $(BIN_TARGETS:%=$(DESTDIR)$(bindir)/%) +install-symlinks: $(BIN_SYMLINKS:%=$(DESTDIR)$(bindir)/%) install-lib: $(STATIC_LIBS:lib%.a.xyzzy=$(DESTDIR)$(libdir)/lib%.a) install-include: $(ALL_INCLUDES:src/include/$(package)/%.h=$(DESTDIR)$(includedir)/$(package)/%.h) $(EXTRA_INCLUDES:src/include/%.h=$(DESTDIR)$(includedir)/%.h) @@ -112,12 +131,6 @@ $(DESTDIR)$(dynlibdir)/lib%.so $(DESTDIR)$(dynlibdir)/lib%.so.$(version_M): lib% $(INSTALL) -l $(@F).$(version) $@.$(version_M) && \ exec $(INSTALL) -l $(@F).$(version_M) $@ -$(DESTDIR)$(libexecdir)/% $(DESTDIR)$(bindir)/%: % package/modes - exec $(INSTALL) -D -m 600 $< $@ - grep -- ^$(@F) < package/modes | { read name mode owner && \ - if [ x$$owner != x ] ; then chown -- $$owner $@ ; fi && \ - chmod $$mode $@ ; } - $(DESTDIR)$(libdir)/lib%.a: lib%.a.xyzzy exec $(INSTALL) -D -m 644 $< $@ diff --git a/package/targets.mak b/package/targets.mak index f0d2715..3ce021d 100644 --- a/package/targets.mak +++ b/package/targets.mak @@ -4,7 +4,7 @@ ifeq ($(MULTICALL),1) BIN_TARGETS := $(package) BIN_SYMLINKS := $(notdir $(wildcard src/$(package)/deps-exe/*)) -EXTRA_TEMP := src/multicall/$(package).c +EXTRA_TARGETS += src/multicall/$(package).c define symlink_definition SYMLINK_TARGET_$(1) := $(package) |