lvm2: allow building static libdm

Yureka 95570a64 6153b45a

+51 -7
+26 -7
pkgs/os-specific/linux/lvm2/common.nix
··· 9 9 , libaio 10 10 , enableCmdlib ? false 11 11 , enableDmeventd ? false 12 - , udev ? null 12 + , udevSupport ? !stdenv.targetPlatform.isStatic, udev ? null 13 + , onlyLib ? stdenv.targetPlatform.isStatic 13 14 , nixosTests 14 15 }: 15 16 ··· 26 27 }; 27 28 28 29 nativeBuildInputs = [ pkg-config ]; 29 - buildInputs = [ udev libuuid libaio ]; 30 + buildInputs = [ 31 + libaio 32 + ] ++ lib.optionals udevSupport [ 33 + udev 34 + ] ++ lib.optionals (!onlyLib) [ 35 + libuuid 36 + ]; 30 37 31 38 configureFlags = [ 32 39 "--disable-readline" ··· 46 53 ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ 47 54 "ac_cv_func_malloc_0_nonnull=yes" 48 55 "ac_cv_func_realloc_0_nonnull=yes" 49 - ] ++ 50 - lib.optionals (udev != null) [ 56 + ] ++ lib.optionals udevSupport [ 51 57 "--enable-udev_rules" 52 58 "--enable-udev_sync" 59 + ] ++ lib.optionals stdenv.targetPlatform.isStatic [ 60 + "--enable-static_link" 53 61 ]; 54 62 55 63 preConfigure = '' ··· 78 86 url = "https://git.alpinelinux.org/aports/plain/main/lvm2/mallinfo.patch?h=3.7-stable&id=31bd4a8c2dc00ae79a821f6fe0ad2f23e1534f50"; 79 87 sha256 = "0g6wlqi215i5s30bnbkn8w7axrs27y3bnygbpbnf64wwx7rxxlj0"; 80 88 }) 89 + ] ++ lib.optionals stdenv.targetPlatform.isStatic [ 90 + ./no-shared.diff 81 91 ]; 82 92 83 93 doCheck = false; # requires root 84 94 85 - makeFlags = lib.optionals (udev != null) [ 95 + makeFlags = lib.optionals udevSupport [ 86 96 "SYSTEMD_GENERATOR_DIR=$(out)/lib/systemd/system-generators" 97 + ] ++ lib.optionals onlyLib [ 98 + "libdm.device-mapper" 87 99 ]; 88 100 89 101 # To prevent make install from failing. 90 102 installFlags = [ "OWNER=" "GROUP=" "confdir=$(out)/etc" ]; 91 103 92 104 # Install systemd stuff. 93 - installTargets = [ "install" ] ++ lib.optionals (udev != null) [ 105 + installTargets = [ "install" ] ++ lib.optionals udevSupport [ 94 106 "install_systemd_generators" 95 107 "install_systemd_units" 96 108 "install_tmpfiles_configuration" 97 109 ]; 98 110 111 + installPhase = lib.optionalString onlyLib '' 112 + install -D -t $out/lib libdm/ioctl/libdevmapper.${if stdenv.targetPlatform.isStatic then "a" else "so"} 113 + make -C libdm install_include 114 + make -C libdm install_pkgconfig 115 + ''; 116 + 99 117 # only split bin and lib out from out if cmdlib isn't enabled 100 118 outputs = [ 101 119 "out" 120 + ] ++ lib.optionals (!onlyLib) [ 102 121 "dev" 103 122 "man" 104 - ] ++ lib.optionals (enableCmdlib != true) [ 123 + ] ++ lib.optionals (!onlyLib && !enableCmdlib) [ 105 124 "bin" 106 125 "lib" 107 126 ];
+25
pkgs/os-specific/linux/lvm2/no-shared.diff
··· 1 + diff --git a/libdm/Makefile.in b/libdm/Makefile.in 2 + index 66ec39513..ab7123dae 100644 3 + --- a/libdm/Makefile.in 4 + +++ b/libdm/Makefile.in 5 + @@ -44,7 +44,6 @@ endif 6 + 7 + LIB_SHARED = $(interface)/libdevmapper.$(LIB_SUFFIX) 8 + LIB_VERSION = $(LIB_VERSION_DM) 9 + -TARGETS = libdevmapper.$(LIB_SUFFIX) libdevmapper.$(LIB_SUFFIX).$(LIB_VERSION) 10 + 11 + CFLOW_LIST = $(SOURCES) 12 + CFLOW_LIST_TARGET = libdevmapper.cflow 13 + diff --git a/make.tmpl.in b/make.tmpl.in 14 + index e7780e8d4..ca4aa9fdd 100644 15 + --- a/make.tmpl.in 16 + +++ b/make.tmpl.in 17 + @@ -346,7 +346,7 @@ SUBDIRS.cflow := $(SUBDIRS:=.cflow) 18 + SUBDIRS.clean := $(SUBDIRS:=.clean) 19 + SUBDIRS.distclean := $(SUBDIRS:=.distclean) 20 + 21 + -TARGETS += $(LIB_SHARED) $(LIB_STATIC) 22 + +TARGETS += $(LIB_STATIC) 23 + 24 + all: $(SUBDIRS) $(TARGETS) 25 +