mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 23:13:19 +00:00
lvm2: allow building static libdm
This commit is contained in:
parent
6153b45ad6
commit
95570a64dc
@ -9,7 +9,8 @@
|
||||
, libaio
|
||||
, enableCmdlib ? false
|
||||
, enableDmeventd ? false
|
||||
, udev ? null
|
||||
, udevSupport ? !stdenv.targetPlatform.isStatic, udev ? null
|
||||
, onlyLib ? stdenv.targetPlatform.isStatic
|
||||
, nixosTests
|
||||
}:
|
||||
|
||||
@ -26,7 +27,13 @@ stdenv.mkDerivation rec {
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ pkg-config ];
|
||||
buildInputs = [ udev libuuid libaio ];
|
||||
buildInputs = [
|
||||
libaio
|
||||
] ++ lib.optionals udevSupport [
|
||||
udev
|
||||
] ++ lib.optionals (!onlyLib) [
|
||||
libuuid
|
||||
];
|
||||
|
||||
configureFlags = [
|
||||
"--disable-readline"
|
||||
@ -46,10 +53,11 @@ stdenv.mkDerivation rec {
|
||||
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
||||
"ac_cv_func_malloc_0_nonnull=yes"
|
||||
"ac_cv_func_realloc_0_nonnull=yes"
|
||||
] ++
|
||||
lib.optionals (udev != null) [
|
||||
] ++ lib.optionals udevSupport [
|
||||
"--enable-udev_rules"
|
||||
"--enable-udev_sync"
|
||||
] ++ lib.optionals stdenv.targetPlatform.isStatic [
|
||||
"--enable-static_link"
|
||||
];
|
||||
|
||||
preConfigure = ''
|
||||
@ -78,30 +86,41 @@ stdenv.mkDerivation rec {
|
||||
url = "https://git.alpinelinux.org/aports/plain/main/lvm2/mallinfo.patch?h=3.7-stable&id=31bd4a8c2dc00ae79a821f6fe0ad2f23e1534f50";
|
||||
sha256 = "0g6wlqi215i5s30bnbkn8w7axrs27y3bnygbpbnf64wwx7rxxlj0";
|
||||
})
|
||||
] ++ lib.optionals stdenv.targetPlatform.isStatic [
|
||||
./no-shared.diff
|
||||
];
|
||||
|
||||
doCheck = false; # requires root
|
||||
|
||||
makeFlags = lib.optionals (udev != null) [
|
||||
makeFlags = lib.optionals udevSupport [
|
||||
"SYSTEMD_GENERATOR_DIR=$(out)/lib/systemd/system-generators"
|
||||
] ++ lib.optionals onlyLib [
|
||||
"libdm.device-mapper"
|
||||
];
|
||||
|
||||
# To prevent make install from failing.
|
||||
installFlags = [ "OWNER=" "GROUP=" "confdir=$(out)/etc" ];
|
||||
|
||||
# Install systemd stuff.
|
||||
installTargets = [ "install" ] ++ lib.optionals (udev != null) [
|
||||
installTargets = [ "install" ] ++ lib.optionals udevSupport [
|
||||
"install_systemd_generators"
|
||||
"install_systemd_units"
|
||||
"install_tmpfiles_configuration"
|
||||
];
|
||||
|
||||
installPhase = lib.optionalString onlyLib ''
|
||||
install -D -t $out/lib libdm/ioctl/libdevmapper.${if stdenv.targetPlatform.isStatic then "a" else "so"}
|
||||
make -C libdm install_include
|
||||
make -C libdm install_pkgconfig
|
||||
'';
|
||||
|
||||
# only split bin and lib out from out if cmdlib isn't enabled
|
||||
outputs = [
|
||||
"out"
|
||||
] ++ lib.optionals (!onlyLib) [
|
||||
"dev"
|
||||
"man"
|
||||
] ++ lib.optionals (enableCmdlib != true) [
|
||||
] ++ lib.optionals (!onlyLib && !enableCmdlib) [
|
||||
"bin"
|
||||
"lib"
|
||||
];
|
||||
|
25
pkgs/os-specific/linux/lvm2/no-shared.diff
Normal file
25
pkgs/os-specific/linux/lvm2/no-shared.diff
Normal file
@ -0,0 +1,25 @@
|
||||
diff --git a/libdm/Makefile.in b/libdm/Makefile.in
|
||||
index 66ec39513..ab7123dae 100644
|
||||
--- a/libdm/Makefile.in
|
||||
+++ b/libdm/Makefile.in
|
||||
@@ -44,7 +44,6 @@ endif
|
||||
|
||||
LIB_SHARED = $(interface)/libdevmapper.$(LIB_SUFFIX)
|
||||
LIB_VERSION = $(LIB_VERSION_DM)
|
||||
-TARGETS = libdevmapper.$(LIB_SUFFIX) libdevmapper.$(LIB_SUFFIX).$(LIB_VERSION)
|
||||
|
||||
CFLOW_LIST = $(SOURCES)
|
||||
CFLOW_LIST_TARGET = libdevmapper.cflow
|
||||
diff --git a/make.tmpl.in b/make.tmpl.in
|
||||
index e7780e8d4..ca4aa9fdd 100644
|
||||
--- a/make.tmpl.in
|
||||
+++ b/make.tmpl.in
|
||||
@@ -346,7 +346,7 @@ SUBDIRS.cflow := $(SUBDIRS:=.cflow)
|
||||
SUBDIRS.clean := $(SUBDIRS:=.clean)
|
||||
SUBDIRS.distclean := $(SUBDIRS:=.distclean)
|
||||
|
||||
-TARGETS += $(LIB_SHARED) $(LIB_STATIC)
|
||||
+TARGETS += $(LIB_STATIC)
|
||||
|
||||
all: $(SUBDIRS) $(TARGETS)
|
||||
|
Loading…
Reference in New Issue
Block a user