From 980f5444d8b33767eddf3c2294dbe4548a4de702 Mon Sep 17 00:00:00 2001 From: "dupont-y@univ-nantes.fr" Date: Wed, 13 Sep 2023 16:09:55 +0200 Subject: [PATCH] add old lvm2 (test) --- glicid/packages/linux.scm | 99 +++++++++++++++++++ .../packages/patches/lvm2-static-link.patch | 36 +++++++ 2 files changed, 135 insertions(+) create mode 100644 glicid/packages/patches/lvm2-static-link.patch diff --git a/glicid/packages/linux.scm b/glicid/packages/linux.scm index 74c3f78..a21445d 100644 --- a/glicid/packages/linux.scm +++ b/glicid/packages/linux.scm @@ -147,3 +147,102 @@ (commit version))) (file-name (git-file-name name version)) (sha256 (base32 "11jjqfgyxq6vd264r812jyilghnaw9qyamfldy5wqfwwibbncjsm")))))) + +(define-public lvm2-past-20311 + (package + (name "lvm2") + (version "2.03.11") + (source (origin + (method url-fetch) + (uri (list (string-append "https://sourceware.org/ftp/lvm2/LVM2." + version ".tgz") + (string-append "ftp://sources.redhat.com/pub/lvm2/releases/LVM2." + version ".tgz"))) + (sha256 + (base32 + "1m4xpda8vbyd89ca0w8nacvnl4j34yzsa625gn990fb5sh84ab44")) + (modules '((guix build utils))) + (snippet + '(begin + (use-modules (guix build utils)) + + ;; Honor sysconfdir. + (substitute* "make.tmpl.in" + (("^confdir = .*$") + "confdir = @sysconfdir@\n") + (("DEFAULT_SYS_DIR = @DEFAULT_SYS_DIR@") + "DEFAULT_SYS_DIR = @sysconfdir@")) + #t)) + (patches (search-patches "lvm2-static-link.patch")))) + (build-system gnu-build-system) + (native-inputs + (list config + pkg-config procps)) ;tests use 'pgrep' + (inputs + `(("libaio" ,libaio) + ("udev" ,eudev))) + (arguments + `(#:phases + (modify-phases %standard-phases + (add-after 'unpack 'update-config + (lambda* (#:key inputs native-inputs #:allow-other-keys) + (install-file (search-input-file + (or native-inputs inputs) "/bin/config.sub") + "autoconf") + (install-file (search-input-file + (or native-inputs inputs) "/bin/config.guess") + "autoconf"))) + (add-after 'configure 'set-makefile-shell + (lambda _ + ;; Use 'sh', not 'bash', so that '. lib/utils.sh' works as + ;; expected. + (setenv "SHELL" (which "sh")) + + ;; Replace /bin/sh with the right file name. + (patch-makefile-SHELL "make.tmpl") + #t))) + + #:configure-flags (list (string-append "--sysconfdir=" + (assoc-ref %outputs "out") + "/etc/lvm") + "--enable-udev_sync" + "--enable-udev_rules" + "--enable-pkgconfig" + "--enable-cmdlib" + "--enable-dmeventd" ; Requires '--enable-cmdlib'. + + ;; Make sure programs such as 'dmsetup' can + ;; find libdevmapper.so. + (string-append "LDFLAGS=-Wl,-rpath=" + (assoc-ref %outputs "out") + "/lib,-rpath=" + (assoc-ref %outputs "out") + "/lib/device-mapper") + ;; This is needed when cross-compiling. + ,@(if (%current-target-system) + '("ac_cv_func_malloc_0_nonnull=yes" + "ac_cv_func_realloc_0_nonnull=yes") + '())) + + ;; The tests use 'mknod', which requires root access. + #:tests? #f)) + (supported-systems (delete "i586-gnu" %supported-systems)) + (home-page "https://sourceware.org/lvm2/") + (synopsis "Logical volume management for Linux") + (description + "LVM2 is the logical volume management tool set for Linux-based systems. +This package includes the user-space libraries and tools, including the device +mapper. Kernel components are part of Linux-libre.") + + ;; Libraries (liblvm2, libdevmapper) are LGPLv2.1. + ;; Command-line tools are GPLv2. + (license (list license:gpl2 license:lgpl2.1)))) + + +(define-public lvm2 + (package + (inherit lvm2-past-20311) + (version "2.03-221-really-2.03.11-for-GLiCID") +)) + + diff --git a/glicid/packages/patches/lvm2-static-link.patch b/glicid/packages/patches/lvm2-static-link.patch new file mode 100644 index 0000000..2ade0a1 --- /dev/null +++ b/glicid/packages/patches/lvm2-static-link.patch @@ -0,0 +1,36 @@ +Fix static linking of 'lvm.static', which indirectly depend on libpthread +and libm via libdevmapper.a. + +--- LVM2.2.02.166/tools/Makefile.in 2016-11-22 21:31:15.521045149 +0100 ++++ LVM2.2.02.166/tools/Makefile.in 2016-11-22 21:31:24.085082767 +0100 +@@ -137,7 +137,7 @@ + lvm.static: $(OBJECTS) lvm-static.o $(LVMINTERNAL_LIBS) + @echo " [CC] $@" + $(Q) $(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacebuilddir) -o $@ $+ \ +- $(DMEVENT_LIBS) $(STATIC_LIBS) $(LVMLIBS) ++ $(DMEVENT_LIBS) $(STATIC_LIBS) $(LVMLIBS) $(PTHREAD_LIBS) + + liblvm2cmd.a: $(top_builddir)/lib/liblvm-internal.a $(OBJECTS) lvmcmdlib.o lvm2cmd.o + @echo " [AR] $@" +--- a/make.tmpl.in 2018-07-31 22:00:39.969983104 +0200 ++++ b/make.tmpl.in 2018-07-31 22:00:58.467613682 +0200 +@@ -63,7 +63,7 @@ + + LIBS += @LIBS@ $(SELINUX_LIBS) $(UDEV_LIBS) $(BLKID_LIBS) $(RT_LIBS) $(M_LIBS) + # Extra libraries always linked with static binaries +-STATIC_LIBS = $(SELINUX_LIBS) $(UDEV_LIBS) $(BLKID_LIBS) ++STATIC_LIBS = $(SELINUX_LIBS) $(UDEV_LIBS) $(BLKID_LIBS) $(M_LIBS) + DEFS += @DEFS@ + # FIXME set this only where it's needed, not globally? + CFLAGS ?= @COPTIMISE_FLAG@ @CFLAGS@ +--- a/libdm/make.tmpl.in 2018-12-18 15:22:34.000000000 +0100 ++++ b/libdm/make.tmpl.in 2019-01-29 21:45:33.637345799 +0100 +@@ -57,7 +57,7 @@ + LIBS = @LIBS@ + LIBS += $(SELINUX_LIBS) $(UDEV_LIBS) $(BLKID_LIBS) $(RT_LIBS) -lm + # Extra libraries always linked with static binaries +-STATIC_LIBS = $(SELINUX_LIBS) $(UDEV_LIBS) $(BLKID_LIBS) ++STATIC_LIBS = $(SELINUX_LIBS) $(UDEV_LIBS) $(BLKID_LIBS) $(PTHREAD_LIBS) $(M_LIBS) + DEFS += @DEFS@ + # FIXME set this only where it's needed, not globally? + CFLAGS ?= @COPTIMISE_FLAG@ @CFLAGS@