From 865b06be5d898da2c5d356a2e2b2cdded6d3b4f2 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Fri, 16 Oct 2009 00:22:34 +0200 Subject: [PATCH] Build xbps-{bin,cmpver,digest,pkgdb,repo} as static, and install them as foo.static. Updated README to note the new requirements for it. It will be used to reduce the number of dependencies when building packages in the chroot. --HG-- extra : convert_revision : xtraeme%40gmail.com-20091015222234-360i67zychjge3nh --- bin/xbps-bin/Makefile | 10 +++++++--- bin/xbps-cmpver/Makefile | 6 ++++-- bin/xbps-digest/Makefile | 4 +++- bin/xbps-pkgdb/Makefile | 4 +++- bin/xbps-repo/Makefile | 5 ++++- doc/README | 8 ++++++-- prog.mk | 15 +++++++++------ vars.mk | 3 ++- 8 files changed, 38 insertions(+), 17 deletions(-) diff --git a/bin/xbps-bin/Makefile b/bin/xbps-bin/Makefile index 60c8cd85..f01ae334 100644 --- a/bin/xbps-bin/Makefile +++ b/bin/xbps-bin/Makefile @@ -1,5 +1,9 @@ -BIN = xbps-bin -OBJS = check.o install.o main.o remove.o show-deps.o ../xbps-repo/util.o - TOPDIR = ../.. +include $(TOPDIR)/vars.mk + +BIN = xbps-bin +OBJS = check.o install.o main.o remove.o show-deps.o ../xbps-repo/util.o +STATIC_LIBS += -lz -lacl -lbz2 -llzmadec + include $(TOPDIR)/prog.mk + diff --git a/bin/xbps-cmpver/Makefile b/bin/xbps-cmpver/Makefile index a8e80c5d..ec40c569 100644 --- a/bin/xbps-cmpver/Makefile +++ b/bin/xbps-cmpver/Makefile @@ -1,4 +1,6 @@ -BIN = xbps-cmpver - TOPDIR = ../.. +include $(TOPDIR)/vars.mk + +BIN = xbps-cmpver + include $(TOPDIR)/prog.mk diff --git a/bin/xbps-digest/Makefile b/bin/xbps-digest/Makefile index 849850f9..f50bbbc9 100644 --- a/bin/xbps-digest/Makefile +++ b/bin/xbps-digest/Makefile @@ -1,4 +1,6 @@ +TOPDIR = ../.. +include $(TOPDIR)/vars.mk + BIN = xbps-digest -TOPDIR = ../.. include $(TOPDIR)/prog.mk diff --git a/bin/xbps-pkgdb/Makefile b/bin/xbps-pkgdb/Makefile index 654a86d3..1c515336 100644 --- a/bin/xbps-pkgdb/Makefile +++ b/bin/xbps-pkgdb/Makefile @@ -1,4 +1,6 @@ +TOPDIR = ../.. +include $(TOPDIR)/vars.mk + BIN = xbps-pkgdb -TOPDIR = ../.. include $(TOPDIR)/prog.mk diff --git a/bin/xbps-repo/Makefile b/bin/xbps-repo/Makefile index 12e63462..ff1ed189 100644 --- a/bin/xbps-repo/Makefile +++ b/bin/xbps-repo/Makefile @@ -1,5 +1,8 @@ +TOPDIR = ../.. +include $(TOPDIR)/vars.mk + BIN = xbps-repo OBJS = main.o util.o index.o +STATIC_LIBS += -lz -lbz2 -lacl -llzmadec -TOPDIR = ../.. include $(TOPDIR)/prog.mk diff --git a/doc/README b/doc/README index fa59bd1d..c7f6a508 100644 --- a/doc/README +++ b/doc/README @@ -33,8 +33,12 @@ and install xbps binary packages: * GNU Make * GNU Bison * fakeroot - * wget - * libarchive (development package) + * wget OR curl OR fetch + * libarchive (devel package with static library. + acl, lzma, bzip2 support) + * libacl (devel package with static library) + * lzma/xz (devel package with static library) + * bzip2 (devel package with static library) * perl * sudo diff --git a/prog.mk b/prog.mk index 09dbd1ea..f548c3ff 100644 --- a/prog.mk +++ b/prog.mk @@ -1,23 +1,26 @@ -include $(TOPDIR)/vars.mk - +BIN_STATIC ?= $(BIN).static OBJS ?= main.o -all: $(BIN) +all: $(BIN) $(BIN_STATIC) .PHONY: all +$(BIN_STATIC): $(OBJS) + $(CC) -static $^ $(LDFLAGS) $(STATIC_LIBS) -o $@ + $(BIN): $(OBJS) - $(CC) $(LDFLAGS) $^ -o $@ + $(CC) $^ $(LDFLAGS) -o $@ .PHONY: clean clean: clean-bins clean-objs clean-bins: - -rm -f $(BIN) + -rm -f $(BIN) $(BIN_STATIC) clean-objs: -rm -f $(OBJS) .PHONY: install -install: $(BIN) +install: $(BIN) $(BIN_STATIC) install -d $(SBINDIR) install $(INSTALL_STRIPPED) -m 755 $(BIN) $(SBINDIR) + install $(INSTALL_STRIPPED) -m 755 $(BIN_STATIC) $(SBINDIR) diff --git a/vars.mk b/vars.mk index c7b15124..36263747 100644 --- a/vars.mk +++ b/vars.mk @@ -13,7 +13,8 @@ ETCDIR ?= $(PREFIX)/etc TOPDIR ?= .. INSTALL_STRIPPED ?= -s -LDFLAGS += -L$(TOPDIR)/lib -L$(PREFIX)/lib -lxbps +STATIC_LIBS ?= -lprop -lpthread -larchive +LDFLAGS += -L$(TOPDIR)/lib -L$(PREFIX)/lib -lxbps CPPFLAGS += -I$(TOPDIR)/include -D_BSD_SOURCE -D_XOPEN_SOURCE=600 CPPFLAGS += -D_GNU_SOURCE WARNFLAGS ?= -pedantic -std=c99 -Wall -Wextra -Werror -Wshadow -Wformat=2