lvm2: allow building static libdm

Yureka 95570a64 6153b45a

+51 -7
+26 -7
pkgs/os-specific/linux/lvm2/common.nix
··· 9 , libaio 10 , enableCmdlib ? false 11 , enableDmeventd ? false 12 - , udev ? null 13 , nixosTests 14 }: 15 ··· 26 }; 27 28 nativeBuildInputs = [ pkg-config ]; 29 - buildInputs = [ udev libuuid libaio ]; 30 31 configureFlags = [ 32 "--disable-readline" ··· 46 ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ 47 "ac_cv_func_malloc_0_nonnull=yes" 48 "ac_cv_func_realloc_0_nonnull=yes" 49 - ] ++ 50 - lib.optionals (udev != null) [ 51 "--enable-udev_rules" 52 "--enable-udev_sync" 53 ]; 54 55 preConfigure = '' ··· 78 url = "https://git.alpinelinux.org/aports/plain/main/lvm2/mallinfo.patch?h=3.7-stable&id=31bd4a8c2dc00ae79a821f6fe0ad2f23e1534f50"; 79 sha256 = "0g6wlqi215i5s30bnbkn8w7axrs27y3bnygbpbnf64wwx7rxxlj0"; 80 }) 81 ]; 82 83 doCheck = false; # requires root 84 85 - makeFlags = lib.optionals (udev != null) [ 86 "SYSTEMD_GENERATOR_DIR=$(out)/lib/systemd/system-generators" 87 ]; 88 89 # To prevent make install from failing. 90 installFlags = [ "OWNER=" "GROUP=" "confdir=$(out)/etc" ]; 91 92 # Install systemd stuff. 93 - installTargets = [ "install" ] ++ lib.optionals (udev != null) [ 94 "install_systemd_generators" 95 "install_systemd_units" 96 "install_tmpfiles_configuration" 97 ]; 98 99 # only split bin and lib out from out if cmdlib isn't enabled 100 outputs = [ 101 "out" 102 "dev" 103 "man" 104 - ] ++ lib.optionals (enableCmdlib != true) [ 105 "bin" 106 "lib" 107 ];
··· 9 , libaio 10 , enableCmdlib ? false 11 , enableDmeventd ? false 12 + , udevSupport ? !stdenv.targetPlatform.isStatic, udev ? null 13 + , onlyLib ? stdenv.targetPlatform.isStatic 14 , nixosTests 15 }: 16 ··· 27 }; 28 29 nativeBuildInputs = [ pkg-config ]; 30 + buildInputs = [ 31 + libaio 32 + ] ++ lib.optionals udevSupport [ 33 + udev 34 + ] ++ lib.optionals (!onlyLib) [ 35 + libuuid 36 + ]; 37 38 configureFlags = [ 39 "--disable-readline" ··· 53 ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ 54 "ac_cv_func_malloc_0_nonnull=yes" 55 "ac_cv_func_realloc_0_nonnull=yes" 56 + ] ++ lib.optionals udevSupport [ 57 "--enable-udev_rules" 58 "--enable-udev_sync" 59 + ] ++ lib.optionals stdenv.targetPlatform.isStatic [ 60 + "--enable-static_link" 61 ]; 62 63 preConfigure = '' ··· 86 url = "https://git.alpinelinux.org/aports/plain/main/lvm2/mallinfo.patch?h=3.7-stable&id=31bd4a8c2dc00ae79a821f6fe0ad2f23e1534f50"; 87 sha256 = "0g6wlqi215i5s30bnbkn8w7axrs27y3bnygbpbnf64wwx7rxxlj0"; 88 }) 89 + ] ++ lib.optionals stdenv.targetPlatform.isStatic [ 90 + ./no-shared.diff 91 ]; 92 93 doCheck = false; # requires root 94 95 + makeFlags = lib.optionals udevSupport [ 96 "SYSTEMD_GENERATOR_DIR=$(out)/lib/systemd/system-generators" 97 + ] ++ lib.optionals onlyLib [ 98 + "libdm.device-mapper" 99 ]; 100 101 # To prevent make install from failing. 102 installFlags = [ "OWNER=" "GROUP=" "confdir=$(out)/etc" ]; 103 104 # Install systemd stuff. 105 + installTargets = [ "install" ] ++ lib.optionals udevSupport [ 106 "install_systemd_generators" 107 "install_systemd_units" 108 "install_tmpfiles_configuration" 109 ]; 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 + 117 # only split bin and lib out from out if cmdlib isn't enabled 118 outputs = [ 119 "out" 120 + ] ++ lib.optionals (!onlyLib) [ 121 "dev" 122 "man" 123 + ] ++ lib.optionals (!onlyLib && !enableCmdlib) [ 124 "bin" 125 "lib" 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 +