[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH Hurd] Add a libstore library without libparted
From: |
Zhaoming Luo |
Subject: |
Re: [RFC PATCH Hurd] Add a libstore library without libparted |
Date: |
Fri, 10 Jan 2025 20:58:56 +0800 |
On Thu, Jan 09, 2025 at 02:09:01PM +0100, Samuel Thibault wrote:
> Hello,
>
> Zhaoming Luo, le jeu. 09 janv. 2025 20:58:22 +0800, a ecrit:
> > The library can be compiled using the following command in the build/
> > directory:
> > ```
> > make libstore-noparted
> > ```
> >
> > This file is the same as libstore/Makefile except a few modifications so
> > it can use the source files from libstore/ and build a libstore with
> > libparted module.
>
> Thanks for working on it. AIUI the only needed modifications are in
> store-types and libstore.so-LDLIBS?
>
> I'm thinking we can probably factorize this, by using something like:
>
> # Use the source files from the libstore library
> VPATH += $(top_srcdir)/libstore
>
> USE_PARTED := 0
>
> include ../libparted/Makefile
>
> and in libparted/Makefile, set USE_PARTED ?= 1 and combine it with
> $(and) like is done for HAVE_LIBZ etc.
>
> And we'll want to make ext2fs link against it rather than libstore, but
> before that, extend storeio to be usable at bootstrap to provide
> partitions.
>
> Samuel
>
> > ---
> > Makefile | 1 +
> > libstore-noparted/Makefile | 97 ++++++++++++++++++++++++++++++++++++++
> > 2 files changed, 98 insertions(+)
> > create mode 100644 libstore-noparted/Makefile
> >
> > diff --git a/Makefile b/Makefile
> > index 9d9e33c3..f8e38b71 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -33,6 +33,7 @@ lib-subdirs = libshouldbeinlibc libihash libiohelp
> > libports \
> > libbpf \
> > libmachdev \
> > libirqhelp \
> > + libstore-noparted \
> >
> > # Hurd programs
> > prog-subdirs = auth proc exec term \
> > diff --git a/libstore-noparted/Makefile b/libstore-noparted/Makefile
> > new file mode 100644
> > index 00000000..e803bdfb
> > --- /dev/null
> > +++ b/libstore-noparted/Makefile
> > @@ -0,0 +1,97 @@
> > +# Makefile for libstore-noparted
> > +#
> > +# Copyright (C) 2025 Free Software Foundation, Inc.
> > +#
> > +# This file is part of the GNU Hurd.
> > +#
> > +# The GNU Hurd is free software; you can redistribute it and/or
> > +# modify it under the terms of the GNU General Public License as
> > +# published by the Free Software Foundation; either version 3, or (at
> > +# your option) any later version.
> > +#
> > +# The GNU Hurd is distributed in the hope that it will be useful, but
> > +# WITHOUT ANY WARRANTY; without even the implied warranty of
> > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> > +# General Public License for more details.
> > +#
> > +# You should have received a copy of the GNU General Public License
> > +# along with this program; if not, write to the Free Software
> > +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
> > +
> > +# This is based on libstore but with out libparted. The initial purpose
> > +# of this library is to avoid the license incompatibility between the
> > +# ext2fs translator and libparted. The ext2fs translator contains
> > +# GPLv2-only code, and the license of libparted is GPLv3-or-later.
> > However,
> > +# the /hurd/ext2fs translator may link to libparted through libstore;
> > this
> > +# library is used to avoid this conflict.
> > +
> > +# Use the source files from the libstore library
> > +VPATH += $(top_srcdir)/libstore
> > +
> > +dir := libstore-noparted
> > +makemode := library
> > +
> > +libname = libstore-noparted
> > +SRCS = create.c derive.c make.c rdwr.c set.c \
> > + enc.c encode.c decode.c clone.c argp.c kids.c flags.c \
> > + open.c xinl.c typed.c map.c url.c unknown.c \
> > + stripe.c $(filter-out ileave.c concat.c,$(store-types:=.c))
> > +
> > +store-types = \
> > + concat \
> > + copy \
> > + device \
> > + file \
> > + ileave \
> > + memobj \
> > + module \
> > + mvol \
> > + nbd \
> > + remap \
> > + task \
> > + zero
> > +
> > +# This has to be evaluated after config.make has been included;
> > +# as a consequence, using 'ifneq' or similar is not an option.
> > +store-types += \
> > + $(and $(HAVE_LIBBZ2),bunzip2) \
> > + $(and $(HAVE_LIBZ),gunzip) \
> > +
> > +libstore.so-LDLIBS += -ldl
> > +installhdrs=store.h
> > +
> > +HURDLIBS = shouldbeinlibc
> > +LDLIBS += -lpthread $(and $(HAVE_LIBBZ2),-lbz2) $(and $(HAVE_LIBZ),-lz)
> > +GUNZIP_OBJS = do-gunzip.o util.o
> > +BUNZIP2_OBJS = do-bunzip2.o
> > +OBJS = $(SRCS:.c=.o) \
> > + $(and $(HAVE_LIBZ),$(GUNZIP_OBJS)) \
> > + $(and $(HAVE_LIBBZ2),$(BUNZIP2_OBJS))
> > +
> > +include ../Makeconf
> > +
> > +module-CPPFLAGS = -D'STORE_SONAME_SUFFIX=".so.$(hurd-version)"'
> > +module-DEPS = $(..)config.make
> > +
> > +libstore_gunzip.so.$(hurd-version): $(GUNZIP_OBJS:.o=_pic.o)
> > +libstore_bunzip2.so.$(hurd-version): $(BUNZIP2_OBJS:.o=_pic.o)
> > +
> > +# You can use this rule to make a dynamically-loadable version of any
> > +# of the modules. We don't make any of these by default, since we
> > +# just include all the standard store types in libstore.so itself.
> > +libstore_%.so.$(hurd-version): %_pic.o libstore.so
> > + $(CC) -shared -Wl,-soname=$@ -o $@ \
> > + $(lpath) $(CFLAGS) $(LDFLAGS) $(libstore_$*.so-LDFLAGS) $^
> > +
> > +# Each libstore_TYPE.a is in fact an object file script so that
> > `-lstore_TYPE'
> > +# just has the same effect as `-u store_TYPE_class'.
> > +$(store-types:%=libstore_%.a): libstore_%.a: $(srcdir)/Makefile
> > + $(CC) -r -nostdlib -nostartfiles -x c /dev/null \
> > + -o $@ -u store_$*_class
> > +cleantarg += $(store-types:%=libstore_%.a)
> > +
> > +all: $(store-types:%=libstore_%.a)
> > +
> > +install: $(addprefix $(DESTDIR),$(store-types:%=$(libdir)/libstore_%.a))
> > +$(addprefix $(DESTDIR),$(store-types:%=$(libdir)/libstore_%.a)):
> > $(DESTDIR)$(libdir)/%: %
> > + $(INSTALL_DATA) $< $@
> > --
> > 2.45.2
> >
> >
>
> --
> Samuel
> <c> xlnt comme sujet de stage je peux essayer de donner une description
> formelle de automake
> -+- #ens-mim -+-