From e7cf222ac95e6b9b4863b4da5131edcf47465bc5 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sun, 21 Dec 2008 23:57:02 +0100 Subject: [PATCH] Reorganize the tree splitting stuff on its own dir. --HG-- extra : convert_revision : 87473fb499c42deaf0285f5559dc1cd8d67ab436 --- .gitignore | 10 ++--- Makefile | 20 +++++++--- bin/Makefile | 33 ++++++++++++++++ {utils => bin}/xbps-bin.c | 2 +- {utils => bin}/xbps-cmpver.c | 2 +- {utils => bin}/xbps-digest.c | 2 +- {utils => bin}/xbps-pkgdb.c | 2 +- {utils => include}/plist.h | 0 {utils => include}/sha256.h | 0 {utils => include}/xbps_api.h | 0 lib/Makefile | 26 ++++++++++++ {utils => lib}/plist.c | 2 +- {utils => lib}/sha256.c | 2 +- {utils/sh => shutils}/binpkg-genindex.sh | 0 {utils/sh => shutils}/binpkg.sh | 0 {utils/sh => shutils}/build_funcs.sh | 0 {utils/sh => shutils}/builddep_funcs.sh | 0 {utils/sh => shutils}/buildvars_funcs.sh | 0 {utils/sh => shutils}/chroot.sh | 0 {utils/sh => shutils}/common_funcs.sh | 0 {utils/sh => shutils}/configure_funcs.sh | 0 {utils/sh => shutils}/cross-compilation.sh | 0 {utils/sh => shutils}/extract_funcs.sh | 0 {utils/sh => shutils}/fetch_funcs.sh | 0 {utils/sh => shutils}/install_funcs.sh | 0 {utils/sh => shutils}/libtool_funcs.sh | 0 {utils/sh => shutils}/mktoolchain.sh | 0 {utils/sh => shutils}/patch_funcs.sh | 0 {utils/sh => shutils}/pkgtarget_funcs.sh | 0 {utils/sh => shutils}/stow_funcs.sh | 0 {utils/sh => shutils}/tmpl_funcs.sh | 0 {utils/sh => shutils}/tmpl_vars.sh | 0 utils/Makefile | 46 ---------------------- vars.mk | 8 ++++ xbps-src.sh | 12 +++--- 35 files changed, 98 insertions(+), 69 deletions(-) create mode 100644 bin/Makefile rename {utils => bin}/xbps-bin.c (99%) rename {utils => bin}/xbps-cmpver.c (98%) rename {utils => bin}/xbps-digest.c (99%) rename {utils => bin}/xbps-pkgdb.c (99%) rename {utils => include}/plist.h (100%) rename {utils => include}/sha256.h (100%) rename {utils => include}/xbps_api.h (100%) create mode 100644 lib/Makefile rename {utils => lib}/plist.c (99%) rename {utils => lib}/sha256.c (99%) rename {utils/sh => shutils}/binpkg-genindex.sh (100%) rename {utils/sh => shutils}/binpkg.sh (100%) rename {utils/sh => shutils}/build_funcs.sh (100%) rename {utils/sh => shutils}/builddep_funcs.sh (100%) rename {utils/sh => shutils}/buildvars_funcs.sh (100%) rename {utils/sh => shutils}/chroot.sh (100%) rename {utils/sh => shutils}/common_funcs.sh (100%) rename {utils/sh => shutils}/configure_funcs.sh (100%) rename {utils/sh => shutils}/cross-compilation.sh (100%) rename {utils/sh => shutils}/extract_funcs.sh (100%) rename {utils/sh => shutils}/fetch_funcs.sh (100%) rename {utils/sh => shutils}/install_funcs.sh (100%) rename {utils/sh => shutils}/libtool_funcs.sh (100%) rename {utils/sh => shutils}/mktoolchain.sh (100%) rename {utils/sh => shutils}/patch_funcs.sh (100%) rename {utils/sh => shutils}/pkgtarget_funcs.sh (100%) rename {utils/sh => shutils}/stow_funcs.sh (100%) rename {utils/sh => shutils}/tmpl_funcs.sh (100%) rename {utils/sh => shutils}/tmpl_vars.sh (100%) delete mode 100644 utils/Makefile create mode 100644 vars.mk diff --git a/.gitignore b/.gitignore index 42d31473a6..c5ebe8969e 100644 --- a/.gitignore +++ b/.gitignore @@ -4,10 +4,10 @@ destdir/ srcdistdir/ builddir/ packages/ -utils/xbps-bin -utils/xbps-cmpver -utils/xbps-digest -utils/xbps-pkgdb -utils/libxbps.so* +bin/xbps-bin +bin/xbps-cmpver +bin/xbps-digest +bin/xbps-pkgdb *.o +*.so* *.bak diff --git a/Makefile b/Makefile index 3a5dd034fb..6be1d5df37 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,25 @@ -PREFIX ?= /usr/local -BINDIR ?= $(PREFIX)/bin +include vars.mk +SUBDIRS = lib bin + +.PHONY: all all: - cd utils && make + for dir in $(SUBDIRS); do \ + $(MAKE) -C $$dir; \ + done +.PHONY: install install: install -D xbps-src.sh $(BINDIR)/xbps-src - cd utils && make install + for dir in $(SUBDIRS); do \ + $(MAKE) -C $$dir install; \ + done uninstall: -rm -f $(BINDIR)/xbps-* +.PHONY: clean clean: - cd utils && make clean + for dir in $(SUBDIRS); do \ + $(MAKE) -C $$dir clean; \ + done diff --git a/bin/Makefile b/bin/Makefile new file mode 100644 index 0000000000..abe3a0f932 --- /dev/null +++ b/bin/Makefile @@ -0,0 +1,33 @@ +include ../vars.mk + +EXTRA_CFLAGS = -funroll-all-loops -ftree-loop-linear +LDFLAGS += -L../lib -Wl,-rpath $$(pwd)/../lib -lxbps + +BINS = xbps-bin xbps-cmpver xbps-digest xbps-pkgdb + +all: $(BINS) +.PHONY: all + +xbps-bin: xbps-bin.o + $(CC) $(LDFLAGS) $^ -o $@ + +xbps-cmpver: xbps-cmpver.o + $(CC) $^ -o $@ + +xbps-digest: xbps-digest.o + $(CC) $(EXTRA_CFLAGS) $(LDFLAGS) $^ -o $@ + +xbps-pkgdb: xbps-pkgdb.o + $(CC) $(LDFLAGS) $^ -o $@ + +.PHONY: clean +clean: clean-bins clean-objs + +clean-bins: + -rm -f $(BINS) + +clean-objs: + -rm -f *.o + +install: $(BINS) + install -D $(BINS) diff --git a/utils/xbps-bin.c b/bin/xbps-bin.c similarity index 99% rename from utils/xbps-bin.c rename to bin/xbps-bin.c index f455a98e4f..92b412ec3e 100644 --- a/utils/xbps-bin.c +++ b/bin/xbps-bin.c @@ -31,7 +31,7 @@ #include #include -#include "xbps_api.h" +#include typedef struct repository_info { const char *index_version; diff --git a/utils/xbps-cmpver.c b/bin/xbps-cmpver.c similarity index 98% rename from utils/xbps-cmpver.c rename to bin/xbps-cmpver.c index 050d8ed1cf..86544330a1 100644 --- a/utils/xbps-cmpver.c +++ b/bin/xbps-cmpver.c @@ -5,7 +5,7 @@ */ #include #include -#include "xbps_api.h" +#include static int chkchr(const char *ch) { diff --git a/utils/xbps-digest.c b/bin/xbps-digest.c similarity index 99% rename from utils/xbps-digest.c rename to bin/xbps-digest.c index bdad91e948..b0476dc19d 100644 --- a/utils/xbps-digest.c +++ b/bin/xbps-digest.c @@ -35,7 +35,7 @@ #include #include -#include "xbps_api.h" +#include static void usage(void) diff --git a/utils/xbps-pkgdb.c b/bin/xbps-pkgdb.c similarity index 99% rename from utils/xbps-pkgdb.c rename to bin/xbps-pkgdb.c index 8443ca946f..435a567fb5 100644 --- a/utils/xbps-pkgdb.c +++ b/bin/xbps-pkgdb.c @@ -30,7 +30,7 @@ #include #include -#include "xbps_api.h" +#include typedef struct pkg_data { const char *pkgname; diff --git a/utils/plist.h b/include/plist.h similarity index 100% rename from utils/plist.h rename to include/plist.h diff --git a/utils/sha256.h b/include/sha256.h similarity index 100% rename from utils/sha256.h rename to include/sha256.h diff --git a/utils/xbps_api.h b/include/xbps_api.h similarity index 100% rename from utils/xbps_api.h rename to include/xbps_api.h diff --git a/lib/Makefile b/lib/Makefile new file mode 100644 index 0000000000..ba63e8eff8 --- /dev/null +++ b/lib/Makefile @@ -0,0 +1,26 @@ +include ../vars.mk + +# The shared library. +MAJOR = 0 +MINOR = 0 +MICRO = 0 +LIBXBPS_SO = $(LIBXBPS).$(MAJOR).$(MINOR).$(MICRO) +LIBXBPS = libxbps.so +LIBXBPS_LDFLAGS = -lprop -shared -Wl,-soname,$(LIBXBPS).$(MAJOR) + +all: $(LIBXBPS) +.PHONY: all + +$(LIBXBPS): sha256.o plist.o + $(CC) $(LIBXBPS_LDFLAGS) $^ -o $(LIBXBPS_SO) + -ln -sf $(LIBXBPS_SO) $(LIBXBPS).$(MAJOR) + -ln -sf $(LIBXBPS_SO) $(LIBXBPS) + +.PHONY: clean +clean: clean-lib clean-objs + +clean-lib: + -rm -f $(LIBXBPS)* + +clean-objs: + -rm -f *.o diff --git a/utils/plist.c b/lib/plist.c similarity index 99% rename from utils/plist.c rename to lib/plist.c index 51eb06f49e..a1967a7541 100644 --- a/utils/plist.c +++ b/lib/plist.c @@ -31,7 +31,7 @@ #include #include -#include "xbps_api.h" +#include struct callback_args { const char *string; diff --git a/utils/sha256.c b/lib/sha256.c similarity index 99% rename from utils/sha256.c rename to lib/sha256.c index 5b309e5e42..07f3e1a7a6 100644 --- a/utils/sha256.c +++ b/lib/sha256.c @@ -41,7 +41,7 @@ #include #include -#include "xbps_api.h" +#include /*** SHA-256 Machine Architecture Definitions *****************/ diff --git a/utils/sh/binpkg-genindex.sh b/shutils/binpkg-genindex.sh similarity index 100% rename from utils/sh/binpkg-genindex.sh rename to shutils/binpkg-genindex.sh diff --git a/utils/sh/binpkg.sh b/shutils/binpkg.sh similarity index 100% rename from utils/sh/binpkg.sh rename to shutils/binpkg.sh diff --git a/utils/sh/build_funcs.sh b/shutils/build_funcs.sh similarity index 100% rename from utils/sh/build_funcs.sh rename to shutils/build_funcs.sh diff --git a/utils/sh/builddep_funcs.sh b/shutils/builddep_funcs.sh similarity index 100% rename from utils/sh/builddep_funcs.sh rename to shutils/builddep_funcs.sh diff --git a/utils/sh/buildvars_funcs.sh b/shutils/buildvars_funcs.sh similarity index 100% rename from utils/sh/buildvars_funcs.sh rename to shutils/buildvars_funcs.sh diff --git a/utils/sh/chroot.sh b/shutils/chroot.sh similarity index 100% rename from utils/sh/chroot.sh rename to shutils/chroot.sh diff --git a/utils/sh/common_funcs.sh b/shutils/common_funcs.sh similarity index 100% rename from utils/sh/common_funcs.sh rename to shutils/common_funcs.sh diff --git a/utils/sh/configure_funcs.sh b/shutils/configure_funcs.sh similarity index 100% rename from utils/sh/configure_funcs.sh rename to shutils/configure_funcs.sh diff --git a/utils/sh/cross-compilation.sh b/shutils/cross-compilation.sh similarity index 100% rename from utils/sh/cross-compilation.sh rename to shutils/cross-compilation.sh diff --git a/utils/sh/extract_funcs.sh b/shutils/extract_funcs.sh similarity index 100% rename from utils/sh/extract_funcs.sh rename to shutils/extract_funcs.sh diff --git a/utils/sh/fetch_funcs.sh b/shutils/fetch_funcs.sh similarity index 100% rename from utils/sh/fetch_funcs.sh rename to shutils/fetch_funcs.sh diff --git a/utils/sh/install_funcs.sh b/shutils/install_funcs.sh similarity index 100% rename from utils/sh/install_funcs.sh rename to shutils/install_funcs.sh diff --git a/utils/sh/libtool_funcs.sh b/shutils/libtool_funcs.sh similarity index 100% rename from utils/sh/libtool_funcs.sh rename to shutils/libtool_funcs.sh diff --git a/utils/sh/mktoolchain.sh b/shutils/mktoolchain.sh similarity index 100% rename from utils/sh/mktoolchain.sh rename to shutils/mktoolchain.sh diff --git a/utils/sh/patch_funcs.sh b/shutils/patch_funcs.sh similarity index 100% rename from utils/sh/patch_funcs.sh rename to shutils/patch_funcs.sh diff --git a/utils/sh/pkgtarget_funcs.sh b/shutils/pkgtarget_funcs.sh similarity index 100% rename from utils/sh/pkgtarget_funcs.sh rename to shutils/pkgtarget_funcs.sh diff --git a/utils/sh/stow_funcs.sh b/shutils/stow_funcs.sh similarity index 100% rename from utils/sh/stow_funcs.sh rename to shutils/stow_funcs.sh diff --git a/utils/sh/tmpl_funcs.sh b/shutils/tmpl_funcs.sh similarity index 100% rename from utils/sh/tmpl_funcs.sh rename to shutils/tmpl_funcs.sh diff --git a/utils/sh/tmpl_vars.sh b/shutils/tmpl_vars.sh similarity index 100% rename from utils/sh/tmpl_vars.sh rename to shutils/tmpl_vars.sh diff --git a/utils/Makefile b/utils/Makefile deleted file mode 100644 index edf83b1498..0000000000 --- a/utils/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -PREFIX ?= /usr/local -BINDIR ?= $(PREFIX)/bin -CFLAGS += -Wall -Werror -O3 -I$(PREFIX)/include -CFLAGS += -funroll-all-loops -ftree-loop-linear -fPIC -DPIC -LDFLAGS += -L $$(pwd) -Wl,-rpath $$(pwd) -lxbps -BINS ?= xbps-bin xbps-cmpver xbps-digest xbps-pkgdb - -# The shared library. -MAJOR = 0 -MINOR = 0 -MICRO = 0 -LIBXBPS_SO = $(LIBXBPS).$(MAJOR).$(MINOR).$(MICRO) -LIBXBPS = libxbps.so -LIBXBPS_LDFLAGS = -lprop -shared -Wl,-soname,$(LIBXBPS).$(MAJOR) - -all: $(LIBXBPS) $(BINS) -.PHONY: all - -$(LIBXBPS): sha256.o plist.o - $(CC) $(LIBXBPS_LDFLAGS) $^ -o $(LIBXBPS_SO) - -ln -sf $(LIBXBPS_SO) $(LIBXBPS).$(MAJOR) - -ln -sf $(LIBXBPS_SO) $(LIBXBPS) - -xbps-bin: xbps-bin.o - $(CC) $(LDFLAGS) $^ -o $@ - -xbps-cmpver: xbps-cmpver.o - $(CC) $^ -o $@ - -xbps-digest: xbps-digest.o - $(CC) $(LDFLAGS) $^ -o $@ - -xbps-pkgdb: xbps-pkgdb.o - $(CC) $(LDFLAGS) $^ -o $@ - -.PHONY: clean -clean: clean-bins clean-objs - -clean-bins: - -rm -f $(BINS) $(LIBXBPS)* - -clean-objs: - -rm -f *.o $(LIBXBPS)* - -install: $(BINS) - install -D $(BINS) $(BINDIR) diff --git a/vars.mk b/vars.mk new file mode 100644 index 0000000000..8216c8d05c --- /dev/null +++ b/vars.mk @@ -0,0 +1,8 @@ +# Common variables. + +PREFIX ?= /usr/local +BINDIR ?= $(PREFIX)/bin +LIBDIR ?= $(PREFIX)/lib + +CPPFLAGS += -I../include +CFLAGS += -O2 -Wall -Werror -fPIC -DPIC diff --git a/xbps-src.sh b/xbps-src.sh index dcf14bdbba..117b225557 100755 --- a/xbps-src.sh +++ b/xbps-src.sh @@ -102,14 +102,12 @@ set_defvars() : ${XBPS_CACHEDIR:=$XBPS_MASTERDIR/var/cache/xbps} : ${XBPS_REGPKGDB_PATH:=$XBPS_CACHEDIR/regpkgdb.plist} : ${XBPS_PKGMETADIR:=$XBPS_CACHEDIR/metadata} - : ${XBPS_UTILSDIR:=$XBPS_DISTRIBUTIONDIR/utils} - : ${XBPS_SHUTILSDIR:=$XBPS_UTILSDIR/sh} - : ${XBPS_DIGEST_CMD:=$XBPS_UTILSDIR/xbps-digest} - : ${XBPS_REGPKGDB_CMD:=$XBPS_UTILSDIR/xbps-pkgdb} - : ${XBPS_CMPVER_CMD:=$XBPS_UTILSDIR/xbps-cmpver} + : ${XBPS_SHUTILSDIR:=$XBPS_DISTRIBUTIONDIR/shutils} + : ${XBPS_DIGEST_CMD:=$XBPS_DISTRIBUTIONDIR/bin/xbps-digest} + : ${XBPS_REGPKGDB_CMD:=$XBPS_DISTRIBUTIONDIR/bin/xbps-pkgdb} + : ${XBPS_CMPVER_CMD:=$XBPS_DISTRIBUTIONDIR/bin/xbps-cmpver} - local DDIRS="XBPS_TEMPLATESDIR XBPS_HELPERSDIR XBPS_UTILSDIR \ - XBPS_SHUTILSDIR" + local DDIRS="XBPS_TEMPLATESDIR XBPS_HELPERSDIR XBPS_SHUTILSDIR" for i in ${DDIRS}; do eval val="\$$i" [ ! -d "$val" ] && msg_error "cannot find $i, aborting."