From 6ee35486bf79af98af753ad3ebcb58f3edc079f0 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Mon, 22 Dec 2008 02:14:40 +0100 Subject: [PATCH] To use xbps now 'make and make install' is required. --HG-- extra : convert_revision : 976738f26daf1ccd2101ca2325e1e517d98e71cb --- Makefile | 11 +++++++++-- bin/Makefile | 5 +++-- doc/README | 12 ++++++++---- lib/Makefile | 4 ++++ shutils/builddep_funcs.sh | 2 +- shutils/chroot.sh | 24 ++++++++++++++++++++++++ shutils/fetch_funcs.sh | 2 +- vars.mk | 2 +- xbps-src.sh | 5 +---- 9 files changed, 52 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 6be1d5df374..95401d7bc4f 100644 --- a/Makefile +++ b/Makefile @@ -10,13 +10,20 @@ all: .PHONY: install install: - install -D xbps-src.sh $(BINDIR)/xbps-src + install -D xbps-src.sh $(SBINDIR)/xbps-src for dir in $(SUBDIRS); do \ $(MAKE) -C $$dir install; \ done + @echo + @echo "Binaries have been installed into $(SBINDIR)." + @echo "Librares have been installed into $(LIBDIR)." + @echo + @echo "WARNING: Don't forget to rerun ldconfig(1)." + @echo uninstall: - -rm -f $(BINDIR)/xbps-* + -rm -f $(SBINDIR)/xbps-* + -rm -f $(LIBDIR)/libxbps.so* .PHONY: clean clean: diff --git a/bin/Makefile b/bin/Makefile index abe3a0f932a..8bac0c8bf44 100644 --- a/bin/Makefile +++ b/bin/Makefile @@ -1,7 +1,7 @@ include ../vars.mk EXTRA_CFLAGS = -funroll-all-loops -ftree-loop-linear -LDFLAGS += -L../lib -Wl,-rpath $$(pwd)/../lib -lxbps +LDFLAGS += -L../lib -lxbps BINS = xbps-bin xbps-cmpver xbps-digest xbps-pkgdb @@ -30,4 +30,5 @@ clean-objs: -rm -f *.o install: $(BINS) - install -D $(BINS) + install -d $(SBINDIR) + install -m 755 $(BINS) $(SBINDIR) diff --git a/doc/README b/doc/README index b658f68f3e1..004b6e8d725 100644 --- a/doc/README +++ b/doc/README @@ -49,10 +49,14 @@ PLEASE NOTE THAT fakechroot or fakeroot-ng DO NOT WORK. HOW TO USE IT ------------------------------------------------------------------------------ -Before using xbps, some required utilities need to be built in the -bin and lib directories. You can do this by issuing "make" in the top level -directory and edit the configuration file located at the xbps directory. -By default it uses the xbps directory in your $HOME. +Before using xbps, some required utilities need to be built and installed +into $(PREFIX); by default they are installed into /usr/local. +You can do this by issuing "make" and "make install" as root in the top +level directory. + +Now you should edit the configuration file located in the etc directory +in the top level directory. By default it uses the xbps directory in +your $HOME. If configuration file is not specified from the command line with the -c flag, it will first try to use the default location at diff --git a/lib/Makefile b/lib/Makefile index ba63e8eff8e..31335460969 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -16,6 +16,10 @@ $(LIBXBPS): sha256.o plist.o -ln -sf $(LIBXBPS_SO) $(LIBXBPS).$(MAJOR) -ln -sf $(LIBXBPS_SO) $(LIBXBPS) +install: $(LIBXBPS) + install -d $(LIBDIR) + install -m 644 $(LIBXBPS_SO) $(LIBDIR) + .PHONY: clean clean: clean-lib clean-objs diff --git a/shutils/builddep_funcs.sh b/shutils/builddep_funcs.sh index be49a4bf982..d78f0b5c301 100644 --- a/shutils/builddep_funcs.sh +++ b/shutils/builddep_funcs.sh @@ -207,7 +207,7 @@ check_installed_pkg() iver="$($XBPS_REGPKGDB_CMD version $pkgname)" if [ -n "$iver" ]; then - $XBPS_CMPVER_CMD $pkgname-$iver $pkgname-$reqver + xbps-cmpver $pkgname-$iver $pkgname-$reqver [ $? -eq 0 ] && return 0 fi diff --git a/shutils/chroot.sh b/shutils/chroot.sh index ca9d655a999..b89db44add8 100644 --- a/shutils/chroot.sh +++ b/shutils/chroot.sh @@ -122,6 +122,28 @@ rebuild_ldso_cache() echo " done." } +install_xbps_utils() +{ + local needed= + local xbps_prefix=$XBPS_MASTERDIR/usr/local + + for f in bin cmpver digest pkgdb; do + if [ ! -x $xbps_prefix/sbin/xbps-${f} ]; then + needed=yes + fi + done + + if [ -n "$needed" ]; then + echo "=> Building and installing xbps utils." + chroot $XBPS_MASTERDIR sh -c \ + "echo /usr/local/lib > /etc/ld.so.conf" + chroot $XBPS_MASTERDIR make -C /xbps + chroot $XBPS_MASTERDIR make -C /xbps install + chroot $XBPS_MASTERDIR make -C /xbps clean + rebuild_ldso_cache + fi +} + xbps_chroot_handler() { local action="$1" @@ -135,6 +157,8 @@ xbps_chroot_handler() rebuild_ldso_cache mount_chroot_fs + install_xbps_utils + if [ "$action" = "chroot" ]; then env in_chroot=yes chroot $XBPS_MASTERDIR /bin/bash else diff --git a/shutils/fetch_funcs.sh b/shutils/fetch_funcs.sh index ebbc434861e..b7c4f2e2a20 100644 --- a/shutils/fetch_funcs.sh +++ b/shutils/fetch_funcs.sh @@ -34,7 +34,7 @@ verify_sha256_cksum() [ -z "$file" -o -z "$cksum" ] && return 1 - filesum=$($XBPS_DIGEST_CMD $XBPS_SRCDISTDIR/$file) + filesum=$(xbps-digest $XBPS_SRCDISTDIR/$file) if [ "$origsum" != "$filesum" ]; then msg_error "SHA256 checksum doesn't match for $file." fi diff --git a/vars.mk b/vars.mk index 8216c8d05c6..567072440c2 100644 --- a/vars.mk +++ b/vars.mk @@ -1,7 +1,7 @@ # Common variables. PREFIX ?= /usr/local -BINDIR ?= $(PREFIX)/bin +SBINDIR ?= $(PREFIX)/sbin LIBDIR ?= $(PREFIX)/lib CPPFLAGS += -I../include diff --git a/xbps-src.sh b/xbps-src.sh index ee88322bf7d..0561d66dfc5 100755 --- a/xbps-src.sh +++ b/xbps-src.sh @@ -103,9 +103,6 @@ set_defvars() : ${XBPS_REGPKGDB_PATH:=$XBPS_CACHEDIR/regpkgdb.plist} : ${XBPS_PKGMETADIR:=$XBPS_CACHEDIR/metadata} : ${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_SHUTILSDIR" for i in ${DDIRS}; do @@ -114,7 +111,7 @@ set_defvars() done XBPS_REGPKGDB_CMD="env XBPS_REGPKGDB_PATH=$XBPS_REGPKGDB_PATH \ - $XBPS_REGPKGDB_CMD" + xbps-pkgdb" } #